|
problem with labels and formatting |
Posted by shawn bright on Jun-08-2011 06:34 |
|
Hey all,
i am having trouble with getting my numbers to format to two decimal places.
i have used layer.setDataLabelFormat("{value|2}") but that formats numbers that appear
on the bars (using a bar chart) themselves, not the scale on the right side.
i actually need not to use the numbers on the bars. Just the ones on the right.
how do i format the numbers on the scale, the numbers on the right of the graph?
thanks
|
Re: problem with labels and formatting |
Posted by Peter Kwan on Jun-08-2011 17:50 |
|
Hi shawn,
To configure the y-axis labels, please use Axis.setLabelFormat. For example (in VB.NET):
c.yAxis().setLabelFormat("{value|2}")
(If you are using yAxis2, please change the above code to yAxis2.)
Just in case you also want the labels to appear on top of the bar outside the bar, the API is Layer.setAggregateLabelFormat
Hope this can help.
Regards
Peter Kwan |
Re: problem with labels and formatting |
Posted by shawn bright on Jun-08-2011 23:08 |
|
Thanks for your attention on this.
I am still not getting the values to look correctly.
Here is the code I am using to generate the graph.
c.addTitle(rain_sensor.alias, "timesbi.ttf", 14)
# add the bar data
layer = c.addBarLayer(data_plots, 0x8080ff)
c.yAxis().setLabelFormat("{value|2}")
layer.set3D(2)
layer.setBarShape(ChartDirector::CircleShape)
c.xAxis().setLabels(data_dates)
c.yAxis().setTitle("inches")
# Add a title to the x axis
c.xAxis().setTitle("week ending")
c.setYAxisOnRight(true)
send_data(c.makeChart2(ChartDirector::PNG), :type => "image/png", :disposition => "inline")
Again, thanks for your time on this.
|
Re: problem with labels and formatting |
Posted by Peter Kwan on Jun-09-2011 01:52 |
|
Hi Shawn,
There is no enough space on the right side to show 2 decimal place. The second decimal place goes outside the chart.
To solve the problem, please reduce the width of the plot area by 10 pixels.
Hope this can help.
Regards
Peter Kwan |
Re: problem with labels and formatting |
Posted by shawn bright on Jun-09-2011 02:29 |
|
Oh my God!
Hey thanks for your help on this, geez what a silly mistake.
All looks good now.
thanks again. |
|