how to add/remove y axis values dynamically on Bar chart (Horizontal)?

50 views
Skip to first unread message

Kumarasamy R

unread,
Nov 29, 2013, 2:17:06 PM11/29/13
to gf...@googlegroups.com
Please help me here.

Horizontal Bar chart Y axis values has to be dynamically generated. Y axis values need to be added or removed when the chart redraw.

Another way of my question,

Bar chart currently has 5 Y axis labels (5 bars), now I want to add 2 more y axis value and remove 1 y axis value based on trigger event. 

Please let me know if my question is not understandable.


my code here,

                BarChart barChart = new BarChart(true, barLabels1.length, barLabels1, barValues1);  // model object
               
                chart.getModel().removeAllSeries();

// chart.getPlotOptions().addYAxisOptions(getYAxisOptions(barChart.getTickSize(), barChart.getyAxisLabel(), barChart.getyAxisValues()));  ------------> this is not working

BarChartValueSeriesBuilder.setSeriesValues(chart.getModel(), barChart);   ----- > Adding the series and this works

chart.redraw(true);





Thank you
Kumar

Nicolas Morel

unread,
Nov 29, 2013, 2:53:14 PM11/29/13
to gf...@googlegroups.com
I'm not sure to understand.

To do things dynamically, just change your model and/or options and call the redraw method.
You should try the latest version, the redraw has been improved.

Kumarasamy R

unread,
Dec 3, 2013, 6:55:17 PM12/3/13
to gf...@googlegroups.com
This helps,

AxesOptions yAxesOptions = AxesOptions.create();
yAxesOptions.addAxisOptions(AxisOptions.create.......)
chart().getPlotOptions().setYAxesOptions(yAxesOptions);
chart.redraw(true);

Thanks
Kumar
Reply all
Reply to author
Forward
0 new messages