Hi,
We are using Highcharts for displaying multiple online charts that update with a new point every second.
Once the charts reach their points limit we use the "shift" flag in the addPoint function to override old points.
The problem is that the shift flag doesn't affect the hidden charts and their list of points get overflowed.
Relevant code from Series.java:
public Series addPoint(Point point, boolean redraw, boolean shift, Animation animation) {
if (!isRendered() || chart.isPersistent()) {
// If we haven't been rendered, then just store the point in ourselves for now.
points.add(point);
} ...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Agreed that this is a bug, thanks for reporting! The fix for this will be included in the next release, but for those that may need the fix in the meantime - below is the updated version of the Series.addPoint method:
publicSeriesaddPoint(Pointpoint,booleanredraw,booleanshift,Animationanimation){
//Ifwehaven't been rendered, then just store the point in ourselves for now. Or, // if persistence is enabled than we need to store the point locally as well (so we have it if // the chart is dynamically moved to another panel). if (!isRendered() || chart.isPersistent()) {//Needtomanuallyshifttheitemoffthelistifwehaven't been rendered //yet(afterwe're rendered Highcharts handles the shift on its own) if(shift && points.size() > 0) { points.remove(0); }//Ifwehaven't been rendered, then just store the point in ourselves for now. points.add(point); } if (isRendered()) {//We'll store the point directly in the DOM if we'vealreadybeenrenderedfinalJavaScriptObjectnativeSeries=chart.get(this.id);if(nativeSeries!=null){
if(animation==null||animation.getOptions()==null){
finalbooleananimationFlag=animation!=null;if(point==null||(point.isSingleValue()&&point.getY()==null)){
nativeAddPoint(nativeSeries,null,redraw,shift,animationFlag);}elseif(point.isSingleValue()&&!chart.isPersistent()&&!point.hasNativeProperties()){
nativeAddPoint(nativeSeries,point.getY().doubleValue(),redraw,shift,animationFlag);}else{
nativeAddPoint(nativeSeries,convertPointToJavaScriptObject(point),redraw,shift,animationFlag);}
}else{
finalJavaScriptObjectanimationOptions=animation.getOptions().getJavaScriptObject();if(point==null||(point.isSingleValue()&&point.getY()==null)){
nativeAddPoint(nativeSeries,null,redraw,shift,animationOptions);}elseif(point.isSingleValue()&&!chart.isPersistent()&&!point.hasNativeProperties()){
nativeAddPoint(nativeSeries,point.getY().doubleValue(),redraw,shift,animationOptions);}else{
nativeAddPoint(nativeSeries,convertPointToJavaScriptObject(point),redraw,shift,animationOptions);}
}
}
}
returnthis;}
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
We are using Highcharts for displaying multiple online charts that update with a new point every second.
Once the charts reach their points limit we use the "shift" flag in the addPoint function to override old points.
The problem is that the shift flag doesn't affect the hidden charts and their list of points get overflowed.
Relevant code from Series.java:
public Series addPoint(Point point, boolean redraw, boolean shift, Animation animation) {
if (!isRendered() || chart.isPersistent()) {
// If we haven't been rendered, then just store the point in ourselves for now.
points.add(point);
} ...
Agreed that this is a bug, thanks for reporting! The fix for this will be included in the next release, but for those that may need the fix in the meantime - below is the updated version of the Series.addPoint method: