I'm currently using GWT highcharts wrapper (1.5.0) with highcharts.js (2.3.3) and I highlight a strange behavior using categories for XAxis and step option.
Here is a piece of code:
private Chart chart;
AViewConstructor() {
chart = new Chart();
chart.setType(Series.Type.LINE);
chart.setTitle("Foo Chart");
mainContainer.add(chart);
}
/**
* Labels number and series length may vary during application lifecycle
*/
void anotherMethodCalledLater(String... labels) {
chart.getXAxis().setTickmarkPlacement(TickmarkPlacement.ON);
chart.getXAxis().setLabels(new XAxisLabels().setRotation(23).setStep(10));
chart.getXAxis().setCategories(true, labels);
}
/**
* Same as above
*/
void yetAnotherMethodCalledLater(String name, Number[] values) {
Series series = chart.createSeries();
series.setPoints(values);
series.setName(name);
chart.addSeries(series, true, true);
}
All method/setting/configuration invoked after Chart construction and addition to the visible GWT 'DOM' are well applied, except for XAxis::step
Making XAxis::step configuration before adding chart to GWT 'Dom' is well applied.
I realized this option is not taken in account while chart is present in GWT 'Dom'.
If I make something ugly like the following 'solves' the problem :
Maybe I do something wrong ?
If yes, Could someone give me an explanation and a sample ?
If no, From which component the limitation is due ? (GWT ? Hightcharts GWT wrapper ? Highcharts JS lib ?) And Is it patchable ?
Many thanks in advance,
Sancho
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Not sure I totally follow your question, but the core Highcharts JS API only supports certain things that can be done to the chart after it is rendered (e.g. adding/removing a series, changing the chart title, updating the data points, etc.) Most of the other configuration options of the chart can only be set before the chart is rendered (at least in the current version of Highcharts this is the case; future versions could certainly improve this). So, if you do want to change some of the configuration details of the chart (such as whether or not the tickmarks are visible or not) you would need to remove the chart and re-add it (GWT Highcharts provides the "Chart.setPersistent()" method to help support this case if you need it.)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi all,
I'm currently using GWT highcharts wrapper (1.5.0) with highcharts.js (2.3.3) and I highlight a strange behavior using categories for XAxis and step option.
Here is a piece of code:
All method/setting/configuration invoked after Chart construction and addition to the visible GWT 'DOM' are well applied, except for
XAxis::step
Making
XAxis::step
configuration before adding chart to GWT 'Dom' is well applied.I realized this option is not taken in account while chart is present in GWT 'Dom'.
If I make something ugly like the following 'solves' the problem :
Maybe I do something wrong ?
If yes, Could someone give me an explanation and a sample ?
If no, From which component the limitation is due ? (GWT ? Hightcharts GWT wrapper ? Highcharts JS lib ?) And Is it patchable ?
Many thanks in advance,
Sancho
Not sure I totally follow your question, but the core Highcharts JS API only supports certain things that can be done to the chart after it is rendered (e.g. adding/removing a series, changing the chart title, updating the data points, etc.) Most of the other configuration options of the chart can only be set before the chart is rendered (at least in the current version of Highcharts this is the case; future versions could certainly improve this). So, if you do want to change some of the configuration details of the chart (such as whether or not the tickmarks are visible or not) you would need to remove the chart and re-add it (GWT Highcharts provides the "Chart.setPersistent()" method to help support this case if you need it.)