highcharts - zoom issue after changing series data - highcharts

There is a strange behavior ar may be even bug in highcharts. If I change series data while chart is zoomed, I can't zoom it anymore:(((
Here are steps to reproduce
Goto http://jsfiddle.net/CXKmD/2/
Zoom chart using mouse
Click "Change" button to change chart's data
Try to zoom again using mouse
The problem is that after these steps event.xAxis is undefined, so we can't get min/max values of mouse zoom selection.
Are there any workarounds to let chart change it's data in zoomed state and then zoom it even further?

Not a bug
You are unnecessarily converting the timestamps to date objects, whereas the setExteremeMethod expects timestamps, while now you are passing it a date. Changed your code to this and it worked
if (event.xAxis[0]) {
startDt = event.xAxis[0].min;
endDt = event.xAxis[0].max;
}
fiddle # http://jsfiddle.net/jugal/tdkwy/

Related

HighCharts - Zoom View Resets

We are building an iOS app using HighCharts components. Defined HIColumn for Bar Chart in XAxis with couple of HISpline (AreaChart) overlay on yAxis that can be toggled. When a user is zoomed in to a specific xAxis period, upon adding the spline, the Chart looses the Zoom and redraw itself. Is it possible to add a spline at runtime without loosing the zoom? These are the things I tried:
Set Min/Max on XAxis. How can we get the current Min/Max/tickInterval when the user zoom in on the xAxis.
Instead of dynamically adding the spline, tried making it visible true/false but still the chart refresh and lose the zoom.
Any help is appreciated.
Thanks!

Changinx Bar Charts X position on Highcharts

We have a request from customer and we need to trick the highcharts bar view.
The problem is our series contain timestamp vs value but business wise this value is corresponding to previous timestamp to that value's timestamp. So we would like to show the bars in between of these timestamps.
So is there an easy way to do this in highcharts w/o playing with the points in the series.
See images below;
Current Highchart Behaviour
Requested Chart Behaviour
You can use xAxis.tickPositioner in order to move ticks and xAxis.labels.formatter to change labels values.
Live example: https://jsfiddle.net/h9zjmqap/
Output:

Core Plot: Pinch to change x axis range

So I have a simple line XY Graph with integer values on the Y axis and dates on the X axis. What I would be like to be able to do is do a horizontal two-finger pinch and adjust the range dynamically. Eg, pinching in would give you a bigger range (mental model being that you're setting the start and end date shown to be further apart) and then pinching out would give you smaller time window.
Is there some stuff built in for this already? Reasonably new to CorePlot and the default finger stuff just zooms the graph itself, none of the values.
Would I need to put a gesture recgoniser on it? or does coreplot have stuff build into it for this?
Cheers
This is how the built-in zoom features work. Use a plot space delegate to monitor changes to the plot space while zooming and make changes to the axis appearance as needed based on the changes. See my answer to your other question for more info.

Changing lables on x-axis like from Monday to show M as per window size in HighCharts

I am using highcharts library to draw chart and I need to display Weekdays as labels on x-axis and also to auto reset it like from Monday to M if all weekdays can't fit on screen.
It should be dynamic, which means no flickering should appear when changing label text on x-axis.
Any suggestions?
Thanks in advance.
There is no straight option for that, rather simple workaround:
Disable reflow from Highcharts, use window.resize browser event
In that event add condition to decide showing full name of just shortened, and set this for chart - chart.xAxis[0].dateTimeLabelFormats should be fine
After setting new format, apply new chart dimensions using chart.setSize(w, h)

Highcharts highstocks - candlestick graph has last value partially cut

In a candlestick graph i am building, the latest bar is cut-off partially such that even the bar is not visible. Thus it's difficult to judge the high and low by seeing the bar.
I'm unable to post a pic now but it's like the last rectangle being cut in half.
I'm tried a lot of options in the api but can't figure out why this is not showing correctly. The chart margin and axis offset options havent' helped. Is there a way i can set the series margin from the plot area so that it displays right.
For this problem, the best solution is to insert a dummy series which should be hidden from every aspect of the chart. So try this, insert a dummy series from the last point of the data series to some extra buffer(as per need). Then remove this series from the chart by explicitly removing it from the legends (using showinlegend),chart(setting linewidth to 0) and from tooltip by having a check in formatter. Hope this solves your problem.
I had the same problem and couldn't figure it out, because no matter how I changed the xAxis.maxPadding or changed the xAxis.max, it would always cut off the last candlestick when I clicked on the range selector.
To solve it, (hack) I just added an extra data point in my series and set it 1 day past the last day and set all values to null.
Without any code or a pic, it's hard to tell the problem, but it sounds like you need to use the max padding option. http://api.highcharts.com/highcharts#xAxis.maxPadding. You may also want to look at endOnTick as well as whether you are setting max on the axis.

Resources