0

I've downloaded android-graphview which is a great library, but I think it have a missing features (which i need). I need to set different color for different point, in a LineGraphSeries. I can only set color for line and background...

int quanti = dati.getCount();
        DataPoint[] data = new DataPoint[quanti];
        String[] orizzontale=new String[quanti];
        int x=0;
        while(dati.moveToNext()){
            data[x]=new DataPoint(x,Integer.parseInt(dati.getString(dati.getColumnIndex("valore"))));
            orizzontale[x]=dati.getString(dati.getColumnIndex("ora"))+":"+dati.getString(dati.getColumnIndex("minuti"));
            x++;
        }
        series = new LineGraphSeries<DataPoint>(data);
        series.setDrawBackground(true);
        series.setDrawDataPoints(true);
        series.setDataPointsRadius(10);
        series.setThickness(2);
        series.setOnDataPointTapListener(new OnDataPointTapListener() {
            @Override
            public void onTap(Series series, DataPointInterface dataPoint) {
                //Toast.makeText(cx,dataPoint,Toast.LENGTH_SHORT).show();
            }
        });
        series.setColor(Color.parseColor("#4fc9dd"));
        series.setBackgroundColor(Color.parseColor("#154fc9dd"));
        staticLabelsFormatter = new StaticLabelsFormatter(grafico);
        staticLabelsFormatter.setHorizontalLabels(orizzontale);
        grafico.getGridLabelRenderer().setLabelFormatter(staticLabelsFormatter);
        grafico.addSeries(series);

so i need something like new DataPoint(x,y,color).

there's a way?

D Ferra
  • 1,223
  • 3
  • 12
  • 21

1 Answers1

0

you could use the PointsGraphSeries where you can set a custom shape renderer for each point.

appsthatmatter
  • 6,347
  • 3
  • 36
  • 40
  • nope. you can't change the color. i've asked to the author and he told me "i will implement this in the weekend"... a month as passed... – D Ferra Apr 22 '15 at 09:30
  • already implemented in the github branch, will be released next week – appsthatmatter Apr 23 '15 at 10:02
  • yep it works! if i can suggest you an edit... it would be nice if i can get the index of that point (example... this is the point number X in the graph) – D Ferra May 06 '15 at 09:15