Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set String values on x-axis on graph?

Tags:

android

graph

I have a lineGraph with float values on both x-axis and y-axis? My question is that how can i set String values on x-axis like date or name of months.I am using GraphView-3.0.jar library.my code is

values_list.add(1.0);
values_list.add(5.0);
values_list.add(9.0);
values_list.add(12.0);
values_list.add(17.0);
values_list.add(1.0);
values_list.add(13.0);
values_list.add(23.0);
graphData = new GraphViewData[(values_list.size())];
double price_copy = 0;
for (int i = 0; i < values_list.size(); i++) {
    price_copy = values_list.get(i);
    graphData[i] = new GraphViewData(i, price_copy);

}
GraphView graphView;

graphView = new LineGraphView(this // context
        , "" );// graphView.addSeries(exampleSeries);// data
graphView.addSeries(new GraphViewSeries("values",
        new GraphViewStyle(Color.rgb(00, 00, 128), 3),
        graphData));

graphView.setShowLegend(true);
// set view port, start=2, size=40
graphView.setViewPort(0, 10);
graphView.setScalable(true);
graphView.setScrollable(true);

LinearLayout layout = (LinearLayout) findViewById(R.id.LNL_CHART);
layout.addView(graphView);

Also i have no idea about AchartEngine,thanks in advance.

like image 728
Kalu Khan Luhar Avatar asked May 02 '26 19:05

Kalu Khan Luhar


1 Answers

Use achart engine library. you can search for that on google. it helped me.Thanks

like image 162
sumit acharya Avatar answered May 04 '26 09:05

sumit acharya