PDA

View Full Version : Is any body used the chart of ScatterChart?



cqhcp
9 Aug 2010, 1:27 AM
In the version of 2.1.1, there is some problem with ScatterChart, maybe it's a bug.
1.The ScatterChart hasn't the method of setDataProvider(), so, in the class of ChatModel, method updateYScale() always throw NullPointException, because the var of "max" and "min" always is null. So I modified this class add the method of setDataProvider().
2.There is no DataProvider can used by ScatterChart, so I created a class named ScatterDataProvider, like this:

public void populateData(ChartConfig config) {
ScatterChart chart = (ScatterChart) config;
chart.getValues().clear();

for (ModelData m : store.getModels()) {
Number n = getValue(m);
Number l = getNumberLabel(m);
if (n != null && l!=null) {
chart.addPoint(n, l);
}
}
}

private Number getNumberLabel(ModelData model){
Number value = null;
if (labelProperty != null) {
Object o = model.<Object> get(labelProperty);
if (o != null) {
if (o instanceof String) {
value = Double.parseDouble((String) o);
} else if (o instanceof Number) {
value = (Number) o;
}
}
}
return value;
}
I used the ScatterDataProvider, but it always can't display the data
How can I do???

cqhcp
9 Aug 2010, 8:33 PM
nobody used ScatterChart?

crehbein
10 Aug 2010, 5:15 AM
I haven't used that one exactly, but if you could weather an upgrade to 2.2.0 beta I think there's finally a fix for the Double vs. double min/max Y NPE. Otherwise, do a search on the forms for ideas for a workaround, there're posts in here somewhere.

bhomass
23 Oct 2012, 5:54 PM
I just started using scatter chart. I am on version 2.2.5.

your problem prob has to do with the fact you swapped n and l in chart.addPoint(n, l);

However, past that point, I am facing the problem that the dots don't display on the chart, unless you hover the mouse over it. Anyone fixed that? I have been looking at this all day, no solution yet.