Hi Parvesh,
In the most general case, you can provide x-coordinates for the data points and the bars to ChartDirector. For example:
BarLayer layer0 = c.addBarLayer(myBarData, ....);
layer0.setXData(xCoordinatesForBars);
LineLayer layer1 = c.addBarLayer(myDataPoints, ....);
layer1.setXData(xCoordinatesForDataPoints);
layer1.setUseYAxis2();
//You may modify the date/time formatting to fit your needs
c.xAxis().setDateScale3("{value|mmm dd/yyyy}");
The above code allows the number of bars and number of data points to be different. It supports bars that can be arbitrarily spaced (as opposed to evenly spaced), and the same for data points.
Note that because the bars are arbitrarily spaced, the bar width cannot be automatically determined. (For example, if you have 11 bars randomly distributed within 30 days, it is hard to know if the bar width should cover 1 day, 2 days, 1 hour or other duration.) ChartDirector will automatically guess the bar width, but it may not be what you need. In this case, please use layer0.setBarWidth to explicitly set the bar width based on the nature of your application.
Hope this can help.
Regards
Peter Kwan |