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
-
Alexey Udovydchenko commented
What about resize? Can be chart area resized by height once yAxis deleted?
-
Anonymous commented
In addition it would be great to supply this second axis with options to use different units. In my example we measure energy consumption and show kWh on the first axis. The user now is able to decide, qhats to be shown on the seconds axis. Like Money, CO2, ... Right now, the whole graph has to be recalculated, this could be avoided i believe.
-
Yakir Manor commented
the small plugin at:
http://jsfiddle.net/highcharts/YDWQC/
works only there's a problem with the link to the highcharts script, i wrote:
<script src="http://code.highcharts.com/highcharts.js"></script>
worked! (with some bugs...) -
Anyway, I added an Axis.remove() method to the plugin. Not sure how it will keep references to series and axes, but it is probably good as a starting point.
-
Luke CSS commented
Nevermind, I found an easy solution for what I am trying to accomplish. I'm just using:
series.hide();
series.show(); -
Luke CSS commented
Thanks a lot, Torstein. Your code is exactly what I was looking for.
I tried searching to see if someone had written code for Axis.remove(), but I couldn't find it. If it's easy for you to do, could you write an Axis.remove() method? :)
-
Atys commented
and either the possibility to pass an array of series or
with redraw true/false parameter to save cpu time -
Dinesh commented
i badly need this feature. In my application i'm creating dynamic series based on user clicks ( with some input values ). At some point of time these series need another Y-axis. I have to redraw the whole graph or additionally create more Y-axis while initiating the chart ( which show white space and looks awkward ) .
-
Tom Chartsalot commented
I completely agree, this would be a fantastic feature
-
The Charter commented
Also what Jim Rubenstein still holds true the text has not been updated yet!!!
-
The Charter commented
Without this feature highcharts in my opinion lose 90% of there value add
-
Bernardo commented
Yes, very very important feature! I obtain data dynamically via ajax calls and never know ahead of time which axes I need. Not being able to add/remove axes dynamically kills the point of adding series dynamically.
-
JM commented
This would an ideal feature for the same reason as above; I want to be able to let the user compute trending data based on the series present after the initial series have been drawn.
-
You're right, the info text is wrong. I've corrected the text.
-
Jim Rubenstein commented
This feature is actually outlined on the feature list for Highcharts (here: http://www.highcharts.com/component/content/frontpage):
"Through a full API you can add, remove and modify series, axes or points at any time after chart creation."
There's no API to add a new Axis object to the Axes list (as the Axis object is "private" in the api)