Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Invient chart - Adding values from DB to pie chart ?
Hi ,
I am working with invient pie chart, I need to set the values for pie chart from DB.
XYSeries series = new XYSeries("Browser Share");
LinkedHashSet<DecimalPoint> points = new LinkedHashSet<DecimalPoint>();
points.add(new DecimalPoint(series, "Firefox", [b]45.0[/b]));
points.add(new DecimalPoint(series, "IE", [b]26.8[/b]));
In the above code I need to set the values 45.0 and 26.8 from DB (thru sql query or any).The values are in 'double' so it must be something like
double firefox = ..........?......... ; //the place where I need your suggestion for getting value from DB
XYSeries series = new XYSeries("Browser Share");
LinkedHashSet<DecimalPoint> points = new LinkedHashSet<DecimalPoint>();
points.add(new DecimalPoint(series, "Firefox", [b]firefox[/b]));
points.add(new DecimalPoint(series, "IE", [b]26.8[/b]));
Please provide a suggestion.
Thank you.
syed mohamed: Hi ,
I am working with invient pie chart, I need to set the values for pie chart from DB.XYSeries series = new XYSeries("Browser Share"); LinkedHashSet<DecimalPoint> points = new LinkedHashSet<DecimalPoint>(); points.add(new DecimalPoint(series, "Firefox", [b]45.0[/b])); points.add(new DecimalPoint(series, "IE", [b]26.8[/b]));
In the above code I need to set the values 45.0 and 26.8 from DB (thru sql query or any).The values are in 'double' so it must be something like
double firefox = ..........?......... ; //the place where I need your suggestion for getting value from DB XYSeries series = new XYSeries("Browser Share"); LinkedHashSet<DecimalPoint> points = new LinkedHashSet<DecimalPoint>(); points.add(new DecimalPoint(series, "Firefox", [b]firefox[/b])); points.add(new DecimalPoint(series, "IE", [b]26.8[/b]));
Please provide a suggestion.
Thank you.
Here, create a list<String> with the items you need names and a double[] array with the values serie (make sure they are the same size) from your DB table, and use the following code...
XYSeries series = new XYSeries("Browser Share");
LinkedHashSet<DecimalPoint> points = new LinkedHashSet<DecimalPoint>();
for (int i=0;i<names.size();i++){
points.add(new DecimalPoint(series,names.get(i),serie[i]));
}
series.setSeriesPoints(points);
chart.addSeries(series);
Cheers,
Hugo