I want to display my output in graphical format using ChartDirector.XYChart.When I use its addLineLayer()method with arugument as Double Type array, then it shows an error "The method addLineLayer(double[]) in the type XYChart is not applicable for the arguments (Double[])".but When I use double as argument then it takes the value.The values in Double Array holds the LinkedHashMap value. So it cant't be represented in primitive type double array. My code is:
//Assign linkedHashMap values to array
Double[] avg= (Double[]) averageMap.values().toArray();
char[] time= rs.getString(logtime).toCharArray();
XYChart c = new XYChart(250, 250);
c.setPlotArea(30, 20, 200, 200);
c.addLineLayer(avg);
Error is on c.addlineLayer.How to fix it.
thanks in advance.
Firstly, it's worth mentioning that
Double[]
anddouble[]
are different types, so you cannot pass one in place of another. (Just as you can't call a method that expectsint
by passing aString
).So you will need to convert your array of Double objects into an array of primitives. If you have no null values, this is simple:
If any of your values are null, you'll have to think about what this means in this context, and how you can handle that. (Skip it? Substitute it with
Double.NaN
? Throw anIllegalArgumentException
?)