When you use DateTime as chart X axis, the graph is not align properly. It always shifts to right.
Can you please check and let me know how to get this right.
this is the code i used
Code: Select all
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
LinearLayout group = (LinearLayout) findViewById(R.id.teeChart);
chart = new TChart(this);
group.addView(chart);
chart.getPanel().setBorderRound(7);
chart.getAspect().setView3D(false);
//common graph settings
chart.getLegend().setAlignment(LegendAlignment.BOTTOM);
chart.getLegend().setLegendStyle(LegendStyle.SERIES);
chart.getLegend().getFont().setSize(20);
chart.getHeader().getFont().setSize(25);
chart.getAxes().getLeft().getTitle().getFont().setSize(15);
chart.getAxes().getLeft().getLabels().getFont().setSize(15);
chart.getAxes().getBottom().getLabels().getFont().setSize(15);
ThemesList.applyTheme(chart.getChart(), 1);
try
{
series = Series.createNewSeries(chart.getChart(), Line.class, null);
series.getXValues().setDateTime(true);
series.add(new DateTime(2014, 05, 16), 5);
series.add(new DateTime(2014, 05, 17), 8);
series.add(new DateTime(2014, 05, 18), 3);
series.add(new DateTime(2014, 05, 19), 4);
series.add(new DateTime(2014, 05, 20), 0);
series.getMarks().setArrowLength(0);
series.getMarks().getFont().setSize(15);
chart.getAxes().getBottom().getLabels().setDateTimeFormat("dd MMM");
chart.getAxes().getBottom().setIncrement(Utils.getDateTimeStep(DateTimeStep.ONEDAY));
}
catch (Exception e)
{
e.printStackTrace();
}
}
Saman