Search code examples
androidcharachartengine

Android achartengine, changine point color of line graph dynamically


Is there any way to change the color of achartengine line graph's line point programmatically based on the y-axis values (i.e, if the value is above 199 then orange or if it is less than 100 then red). Here is my code,

XYSeriesRenderer renderer2 = new XYSeriesRenderer();
            renderer2.setLineWidth(1.5f);
            renderer2.setColor(Color.RED);
            renderer2.setPointStyle(PointStyle.SQUARE);
            renderer2.setFillPoints(true);
mRenderer.addSeriesRenderer(renderer2);

but in the above i can not give different color for line point it takes the line color. also I have attached my resulted graph in which I need to changes

enter image description here

Thanks in advance


Solution

  • You could create another series that would only contain the points that must be orange and add the series after the other line series.