HighLow chart with TimeSeries
Posted: Thu Jan 03, 2013 11:38 pm
Is it possible to create a HighLow chart with a timeseries as the x axis?
I've tried with this code:
Where PHL contains data such as:
But I get a result like this:
So the questions are:
I've tried with this code:
Code: Select all
chart.removeAllSeries();
chart.getAspect().setView3D(false);
//X AXIS
//set the x-axis date display to e.g. '01-JAN'
chart.getAxes().getBottom().getLabels().setDateTimeFormat("dd-MMM");
//set the angle of the date display
chart.getAxes().getBottom().getLabels().setAngle(45);
//Y AXIS
//set up the y axis title
AxisTitle hlTitle;
hlTitle=chart.getAxes().getLeft().getTitle();
hlTitle.setCaption("Severity");
//end title
//set y to increment by 1
//override the auto min/max and set to 0/10
chart.getAxes().getLeft().setAutomaticMaximum(false);
chart.getAxes().getLeft().setAutomaticMinimum(false);
chart.getAxes().getLeft().setMinimum(0.0);
chart.getAxes().getLeft().setMaximum(10.0);
chart.getAxes().getLeft().setIncrement(1.00);
Series hl = new HighLow(chart.getChart());
if(PHL.size()>0){
for(int i=0; i<PHL.size(); i++){
DateTime dt = new DateTime(
DateDiff.getYearFromString(PHL.get(i).getDateRecord()),
DateDiff.getMonthFromString(PHL.get(i).getDateRecord()),
DateDiff.getDayFromString(PHL.get(i).getDateRecord()));
hl.add(dt, (double)PHL.get(i).getSeverity(), PHL.get(i).getName());
}
}
chart.getLegend().setLegendStyle(LegendStyle.SERIES);
chart.getLegend().setAlignment(LegendAlignment.RIGHT);
//chart.getLegend().set
chart.getLegend().setCheckBoxes(true);
chart.getHeader().setVisible(false);
chart.getPanel().setTransparent(true);
chart.getWalls().getBack().setVisible(true);
But I get a result like this:
So the questions are:
- Can HighLow have a TimeSeries
Why does the X axis show the string rather than the date (I was hoping the string would appear in place of 'Series 0')
Can there be more than 1 HighLow series per chart, or does it need to page (this app would have n number of series)