PDA

View Full Version : Is it possible to hide individual points or sections of a line chart?



VLaing
1 Feb 2012, 9:46 AM
Hi
I am a newbie to gxt and I am trying to solve a particular problem. I have modified the LineExample (which draws a line chart) which comes with the gxt-3.0.0-beta2 download; see the attached screenshot, “chartLine1.jpg”. The x-axis goes from Jan to Dec and y-axis goes from 0 to 100.
Basically what I would like to do is to have a gap show up in the line chart i.e. have the line display from Jan to Feb than show a gap (no line) from Feb to Apr and display the line again for Apr to Dec.
If I remove the I simply remove the point (Mar) from the data store using “store(2)” I get the line chart with the point missing and no gap, see the attached screenshot, “chartLine2.jpg”. Any help is greatly appreciated.
Thanks in advance!
Victor

hrishirise
1 Feb 2012, 11:25 AM
You can over ride setLabelProvider, to create a gap on the TimeAxis.
For example like this.

time.setLabelProvider(new LabelProvider<Date>() {
@Override
// Otherwise show empty
public String getLabel(Date item) {
//Your logic of gap based on the item.
}
});

VLaing
1 Feb 2012, 11:29 AM
Thanks I will try that!

BrendanC
21 Feb 2012, 2:28 PM
Related to this I have changed numeric axis and line series to handle values it cannot display like null and NaN. This could be used to create a gap between line series. This change is in SVN and will be in the next release.

BrendanC
21 Feb 2012, 6:03 PM
I have also just added a change in SVN for a gapless boolean on line series. Non-gapless series will use moveto instead of lineto for the path across gaps.