hongyin163 / react-native-chart-android

react native chart modules come from mpandroidchart.
206 stars 81 forks source link

Set intervals for Y axis labels #55

Open sakshityagi opened 7 years ago

sakshityagi commented 7 years ago

I want the labels on Y axis of my line chart to show with definite intervals. For example like 0, 1, 2, 3 or 0, 2,4,6.. so on.

I tried using granularity property as mentioned in MP chart library like :

yAxis={{drawGridLines:true,textColor:"#FFFFFF",granularity:"1"}}

, but nothing happened. Can you please guide me on this.

hongyin163 commented 7 years ago

this project didn't surport granularity ,you can add it to project refer to mpandroidchart project

qianhy commented 7 years ago

你好 我在 MPBarLineChartManager.java 中的private void setYAxisInfo(YAxis axis,ReadableMap v)函数添加了if(v.hasKey("granularity")) axis.setGranularity((float) (v.getDouble("granularity"))); 确实有设置最小间隔,但是我在设置为小数时出现问题。 Y轴标志没有出现预想到的小数数值,反倒都是整数就像是被取整了一样。 yAxis={{ startAtZero:false, drawGridLines:true, granularity:0.1, //granularityEnabled:false, position:"OUTSIDE_CHART", textColor: "#E94343" }}这个是我Y轴设置 希望你能帮我