Ability to add yAxis after graph creation
It would be great to have the ability to add / remove yAxis after a chart has been created. For example, a AJAX response sends back information with new series data which require additional yAxis (or need some of the existing ones to be removed)
Completed as of Highcharts 3.0
-
Senthil commented
Thanks Torstein, I temporarily now fixed it by calling directly scroller.render as for me setExtremes event should not be triggered.
-
@Senthil: This also applies to v1.3. I've logged it for fixing before the release.
-
Senthil commented
Hi Torstein,
One small issue as we add y axis the chart's width adapts to have the y axis line but the navigator width is not getting adjusted. Could you please help in this issue. You can find this issue here by adding multiple series
http://jsfiddle.net/senthil_at/bYPJN/16/Thanks,
Senthil
-
Definately not! It only worked by accident. I've updated the plugin now. The same error also happened on Axis.destroy.
-
Vegard Gillestad commented
It seems that this plugin requires the chart variable to be defined in the global namespace. If not line 37 fails. Im hoping this is not how it is supposed to be? :-)
Im using it with stockchart.
-
Senthil commented
Hi Torstein,
Thanks a lot, It really helped us.
Thanks,
Senthil -
Hi Senthil,
The problem was that the series was tied to the index of the yAxis, which changed when exporting.
I have fixed the issue in the original plugin fiddle. Now the series is bound to the axis by the axis.id, which doesn't change. So in addition to upgrading the plugin itself, you also need to give your dynamically added axis an id, and make the series refer to this id.
In Highcharts 3.0 this is added to the core, so this plugin will be redundant.
-
Senthil commented
Hi Torstein,
Could you please help in fixing the issue of export in stockchart. Its very critical for me and business needs it.Thanks,
Senthil -
Radu Busuioc commented
Hi Torstein,
I'm using this plugin with StockCharts and it works great but the export is not working.
I have started from this example, that is working: http://jsfiddle.net/AHJz2/1/
and changed to StockChart and the export is not working: http://jsfiddle.net/radu_busuioc/tEh6k/1/I think that maybe it's the same problem in a previous message, because the error is Uncaught TypeError: Cannot read property 'series' of undefined
Thank you in advance
-
There's a potential caveat when changing the index of the axes, that series connected to this axis (by its index) are orphaned. A better approach for connecting axes and series would be by id, so that the indices didn't matter.
-
Timo Krieger commented
I had problems when often adding and removing several axis. First, the chart.options.yAxis filled up more and more and second, the axis.options.index had wrong numers - resulting in adding series twice to the correct and to a wrong axis (both with the same index).
Here is my jsfiddle which fixes these problems: http://jsfiddle.net/AHJz2/1/
I don't know if it's a very clean approach, but it's working for me. -
Senthil commented
Hi Torstein,
I was trying to fix in the jsfiddle http://jsfiddle.net/senthil_at/ChNLA/1/. I made some changes and after that I found that after the merge, options.series is null.Could you please tell me is this the root cause or else just point me the path or idea i will work on it. Now i am getting this error
Uncaught TypeError: Cannot call method 'getExtremes' of undefined
-
Senthil commented
Hi Torstein,
Thanks for the help. Can I expect a fix for this. -
@Nitulescu:
I've updated the plugin with support for export
@Senthil:
I thought this also would fix your case, but it doesn't. I'm sorry, but something else seems to be failing. I tried to also modify chart.options.series, but that doesn't help: http://jsfiddle.net/highcharts/hYanM/2/
-
Senthil commented
Hi Torstein,
Could please let me know is the issue which i recreated in jsfiddle can be fixed. Sorry as its critical for me i am re-posting. -
Nitulescu Florin commented
I am using this plugin. Very useful, works great except I'm unable to export the chart. It throws an execption (Uncaught TypeError: Cannot read property 'series' of undefined ) and I can't figure out how to handle it. You can see it in the example (http://jsfiddle.net/YDWQC/) if you add the exporting script (<script src="http://code.highcharts.com/modules/exporting.js"></script>). Anyone has any suggestions on how to get over this?
-
Senthil commented
Thanks for your Response. I have reused your plugin jsfiddle to reproduce my issue. Here is the jsfiddle which is modified by me:
http://jsfiddle.net/senthil_at/hYanM/.
In this one click on "Add Series" and then click on "Switch theme". The theme will be changing but only the series which is created with the chart will be available, series which is added using addSeries method will not be available -
@Senthil,
Can you set up a simplified jsFiddle demo for this?
-
Senthil commented
I am using this plugin in my project. i am able to add and remove series along with yaxis issue came is tried to apply them by new Highcharts.StockChart(Highcharts.merge(options, theme)). The theme is getting switch but the Yaxis doesnt show the name and also after this i am not able to add axis and series throwing tooltip point error(TypeError: c[i].tooltipPoints is undefined). Could you please provide me some help on this
-
Yes, the chart will respond to Chart.setSize() like normal...