achartengine ライブラリ forline グラフを使用しています。タイムスタンプの代わりに、x 軸に日付を表示するにはどうすればよいですか
私のコードは
public GraphicalView getLine(Context context, LinkedHashMap<String, List<Item>> data, String value2, String value3) {
List<TimeSeries> series=new ArrayList<TimeSeries>();
Set<String> keys = data.keySet();
for(String key:keys)
{
TimeSeries series1 = new TimeSeries(key);
List<Item> value=data.get(key);
for(Item itm:value)
{
Double temp=Double.parseDouble(itm.getDataItem(value3));
String temp1=null;
if(value2.equals("created_time"))
{
temp1=itm.getCreated_time();
}
else
{
try
{
temp1=itm.getModified_time();
}
catch (NullPointerException e) {
temp1=itm.getCreated_time();
}
}
Timestamp timestamp = new Timestamp(Integer.parseInt(temp1.substring(0,10)));
Date date = new Date(timestamp.getTime()*1000);
series1.add(date,temp);
}
series.add(series1);
}
XYMultipleSeriesDataset dataset = new XYMultipleSeriesDataset();
for(TimeSeries serie:series)
{
dataset.addSeries(serie);
}
XYMultipleSeriesRenderer mRenderer = new XYMultipleSeriesRenderer(); // Holds a collection of XYSeriesRenderer and customizes the graph
mRenderer.setBackgroundColor(Color.BLACK);
mRenderer.setZoomEnabled(true);
mRenderer.setAntialiasing(true);
for(TimeSeries serie:series)
{
XYSeriesRenderer renderer = new XYSeriesRenderer(); // This will be used to customize line 1
mRenderer.addSeriesRenderer(renderer);
int color;
Random rnd = new Random();
color = Color.argb(200, rnd.nextInt(256), rnd.nextInt(256), rnd.nextInt(256));
renderer.setColor(color);
renderer.setPointStyle(PointStyle.CIRCLE);
renderer.setFillPoints(true);
}
return ChartFactory.getLineChartView(context, dataset, mRenderer);
}