Actually i have contructed an TimeChart
graph in my app. But while showing dates on x axis it shows problem. The code i have used while designing chart using renderer is shown below along with the screen shot. If anyone knows why this problem arises please help me to solve this out.
Code:
Calendar pCalendar_FirstDay = Calendar.getInstance();
int nMinDay = pCalendar_FirstDay.getActualMinimum(Calendar.DATE);
Date currentDate = pCalendar_FirstDay.getTime();
renderer = new XYMultipleSeriesRenderer();
//set value for x axis
renderer.setChartTitle("Weight / Temperature");
renderer.setXLabels(15);
renderer.setXAxisMin(new Date(currentDate.getYear(), currentDate.getMonth(), nMinDay).getTime());
renderer.setXAxisMax(currentDate.getTime());
renderer.setXLabelsAlign(Align.CENTER);
//set value for y axis
renderer.setYLabels(10);
renderer.setYTitle("Weight", 0);
renderer.setYAxisMin(10, 0);
renderer.setYAxisMax(90, 0);
renderer.setYAxisAlign(Align.LEFT, 0);
renderer.setYLabelsAlign(Align.LEFT, 0);
renderer.setPanLimits(new double[]{0,currentDate.getTime(), 10, 90});
renderer.setAxisTitleTextSize(12);
renderer.setChartTitleTextSize(12);
renderer.setLabelsTextSize(10);
renderer.setLegendTextSize(12);
renderer.setPointSize(5f);
renderer.setApplyBackgroundColor(true);
renderer.setBackgroundColor(Color.parseColor("#F5F5F5"));
renderer.setMarginsColor(Color.parseColor("#F5F5F5"));
renderer.setAxesColor(Color.LTGRAY);
renderer.setLabelsColor(Color.parseColor("#5f5f5f"));
renderer.setShowGrid(true);
renderer.setGridColor(Color.GRAY);
The output i got
The output i want is
From your APIs, I presume you are using AChartEngine. How did you build the TimeChart instance? You should be doing something like this:
where pattern is a date formatting format which you should tweak for getting the desired display.