Ich verwende aFreeChart für Android. Der Grund dafür ist, dass ich anfing, JFreeChart zu verwenden, bevor ich erkannte, dass dies nicht mit Android kompatibel war.Verwenden von Android AFreeChart zum Speichern eines Liniendiagramms in einer PNG- oder JPEG-Datei
Ich bin für eine aFreeChart Alternative zu dem unter JFreeChart Methode:
ChartUtilities.saveChartAsJPEG(lineChart, lineChartObject, width, height);
Mein Code für die Liniendiagramm Konstruktion ist wie folgt:
DefaultCategoryDataset line_chart = new DefaultCategoryDataset();
line_chart.addValue(load[23], "load profile", "0");
line_chart.addValue(load[0], "load profile", "1");
line_chart.addValue(load[1], "load profile", "2");
line_chart.addValue(load[2], "load profile", "3");
line_chart.addValue(load[3], "load profile", "4");
line_chart.addValue(load[4], "load profile", "5");
line_chart.addValue(load[5], "load profile", "6");
line_chart.addValue(load[6], "load profile", "7");
line_chart.addValue(load[7], "load profile", "8");
line_chart.addValue(load[8], "load profile", "9");
line_chart.addValue(load[9], "load profile", "10");
line_chart.addValue(load[10], "load profile", "11");
line_chart.addValue(load[11], "load profile", "12");
line_chart.addValue(load[12], "load profile", "13");
line_chart.addValue(load[13], "load profile", "14");
line_chart.addValue(load[14], "load profile", "15");
line_chart.addValue(load[15], "load profile", "16");
line_chart.addValue(load[16], "load profile", "17");
line_chart.addValue(load[17], "load profile", "18");
line_chart.addValue(load[18], "load profile", "19");
line_chart.addValue(load[19], "load profile", "20");
line_chart.addValue(load[20], "load profile", "21");
line_chart.addValue(load[21], "load profile", "22");
line_chart.addValue(load[22], "load profile", "23");
AFreeChart chart = ChartFactory.createLineChart(
"Load Profile over 24hrs", // Title
"Time (Hrs)", // x-axis Label
"Power (kVA)", // y-axis Label
line_chart, // Dataset
PlotOrientation.VERTICAL, // Plot Orientation
true, // Show Legend
true, // Use tooltips
false // Configure chart to generate URLs?
);
Irgendwelche Ideen, wie diese zu retten eine jpg/jpeg/png Datei wäre sehr hilfreich! Ich muss als Bilddatei speichern, da ich es zu einem späteren Zeitpunkt in ein PDF einbetten muss.
Vielen Dank im Voraus!