score:2
Accepted answer
In the setExtremes you can check which button is selected by code:
xAxis: {
events: {
setExtremes: function(e) {
console.log(this);
if(typeof(e.rangeSelectorButton)!== 'undefined')
{
alert('count: '+e.rangeSelectorButton.count + 'text: ' +e.rangeSelectorButton.text + ' type:' + e.rangeSelectorButton.type);
}
}
}
}
You can render your own buttons by:
normalState = new Object();
normalState.stroke_width = null;
normalState.stroke = null;
normalState.fill = null;
normalState.padding = null;
//normalState.r = null;
normalState.style = hash('text-decoration', 'underline');
hoverState = new Object();
hoverState = normalState;
pressedState = new Object();
pressedState = normalState;
chart_1MButton = chart.renderer.button('1M', 96, 10, function() {
chart.xAxis[0].setExtremes(1344527940000, 1346342400000, true);
unselectButtons();
chart_1MButton.setState(2);
}, normalState, hoverState, pressedState);
chart_1MButton.add();
function unselectButtons() {
chart_1MButton.setState(0);
}
score:0
You can do something like the following:
var urls = {
'1m': 'url1',
'3m': 'url2',
'6m': 'url3',
'YTD': 'url4',
'1y': 'url5',
'All': 'url6'
};
$('.highcharts-button').on('click', function() {
var selected = $(this).find('tspan').text()
$.getJSON(urls[selected], function(json) {
// set new data
});
});
This way you'll get the url according to the selected button.
Source: stackoverflow.com
Related Articles
- how do you create custom buttons with highcharts that each data buttons calls anather php script for its data
- Highcharts custom visuals with Data binding PowerBI
- Highcharts - Global configuration with common code and unique data & Headings
- Exporting with custom data label image in highcharts gantt
- Highcharts multiple charts, each with live data
- In highcharts how can I provide data with values x, y, title so that I can put the title in the tooltip?
- Highcharts series visibility with csv data source
- Creating a drilldown chart with Highcharts that contain double(multiple) columns for each column (see example for better explanation)
- Highcharts stock chart not showing up with custom data
- How to have multiple highcharts with different series data in vuejs without repeating code
- Highcharts heatmap with custom colors for each yAxis
- Highcharts cloud issue with data source when duplicating chart
- The continuous update highcharts with more data plotting the continuity is not visible so we need that continuity in the centre of the graph
- Highcharts - Column chart with legend for each data
- how to create a column char with highcharts where each column has a different color
- Highcharts custom buttons with tooltips
- In highCharts so much space left for each category when using index with data
- Create Highcharts data label formatter that filters the data to display
- Highcharts with data from table, how to add custom marker for specific value from specific series?
- Highcharts (highcharts-ng) with ng-repeat worked, But need to pass the data for each chart from the attributes
- Reload chart data via JSON with Highcharts
- Resize data points with highcharts
- Highcharts doesn't display series with lots of data points
- Highcharts data series issue with ajax/json and PHP
- HighCharts - How to create dynamic chart that exports EVERYTHING
- Highcharts - Dyanmic graph with no initial data
- Load data into Highcharts with Ajax
- Updating data in charts, highcharts with angular, highcharts-ng
- Highcharts with JSON data and multiple series
- How to pass custom data into Highcharts graph click event
- Object function() {location.href = this.options.url); has no method 'apply'
- How to define colorAxis dataClasses for solid gauge chart?
- Write JSON parser to format data for pie chart (HighCharts)
- Want to move y-axis scrollbar with mouse wheel in highcharts/highstock
- How to show time duration on y-axis in high chart
- Highcharts: Control show/hide of a div by clicking pie chart slices
- Highchart add a text under single bar in bar chart
- Not appear chart with Highcharts-ng
- Does toggling in React affect highchart display?
- How to Control the highchart, based on external click event
- Clickable HTML element that closes Highcharts tooltip
- HighStocks Array Series
- Highcharts solid gauge with multiple series
- Simultaneous actions on action event on one graph
- Can't detect click function HighCharts plotLines & plotBands.events
- Highcharts shows data but can't display chart
- Highcharts wrap processData on line charts doesn't draw right data points
- Highcharts - not able to resize onclick a button in angular 6
- How to use Highcharts in typescript and react
- Not able to render windbarb Highchart in angular