androidgraphachartenginepoints

aChartEngine remove lines between points


Is it posible to delete the lines between the points??

Here it is my code:

public Intent execute(Context context) {

String[] titles = new String[] { "Systolic Pressure", "Diastolic Pressure"};


List<double[]> x = new ArrayList<double[]>();
for (int i = 0; i < titles.length; i++) {
  x.add(new double[] { 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60 });
}


List<double[]> values = new ArrayList<double[]>();
values.add(new double[] { 108, 110.5, 110, 115, 114, 118, 116, 119, 120, 125.3, 122.2, 123.9 });
values.add(new double[] { 75, 77, 80, 79, 82, 84, 83, 80, 86, 88, 85, 80 });

int[] colors = new int[] { Color.BLUE, Color.RED};
PointStyle[] styles = new PointStyle[] {PointStyle.TRIANGLE, PointStyle.TRIANGLE};
XYMultipleSeriesRenderer renderer = buildRenderer(colors, styles);
setChartSettings(renderer, " ", " ", " ", 0, 60, 0, 250,Color.WHITE,Color.WHITE); 
renderer.setXLabels(12);
renderer.setYLabels(10);
renderer.setShowGridY(true);
renderer.setXLabelsAlign(Align.RIGHT);
renderer.setYLabelsAlign(Align.RIGHT);
renderer.setZoomButtonsVisible(true);
renderer.setPanLimits(new double[] { 0,60, 0, 250 });
renderer.setZoomLimits(new double[] { 0, 60, 0, 250});
XYMultipleSeriesDataset dataset = buildDataset(titles, x, values);
Intent intent = ChartFactory.getLineChartIntent(context, dataset, renderer,"Anesthesia Sheet");

return intent;   }

and here iti is the graphical result:

enter image description here


Solution

  • Rather than using a line chart, use a scatter chart.

    Change:

    Intent intent = ChartFactory.getLineChartIntent(context, dataset, renderer,"Anesthesia Sheet");

    To:

    Intent intent = ChartFactory.getScatterChartIntent(context, dataset, renderer,"Anesthesia Sheet");

    I tried switching the line charts in my app to scatter charts and it worked as expected - the points were plotted with no connecting lines.