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 Query
- how do you create custom buttons with highcharts that each data buttons calls anather php script for its data
- how do you create muliple charts with the same options but with different data
- In highcharts how can I provide data with values x, y, title so that I can put the title in the tooltip?
- How to have multiple highcharts with different series data in vuejs without repeating code
- how to create a column char with highcharts where each column has a different color
- How do you create a Hight Charts chart that updates every second with real data?
- how do you create a link on highcharts to open up pop up window with another chart
- How do you get the mouse hovered label value with the highcharts custom event plugin?
- Highcharts with data from table, how to add custom marker for specific value from specific series?
- How do you change the colour of each category within a highcharts column chart?
- HighCharts - How to create dynamic chart that exports EVERYTHING
- Highcharts custom visuals with Data binding PowerBI
- How to pass custom data into Highcharts graph click event
- How to structure Angular with Highcharts and lots of dynamic data
- Highcharts - Global configuration with common code and unique data & Headings
- How to populate a Highcharts axis with string formatted data from a PHP array
- How to handle HighCharts zooming with large data sets
- How can I force ticks/grid lines on a Highcharts datetime X axis to arbitrarily line up with data points?
- How to Build a Column Chart in Highcharts with Data Entered Dynamically Within a CMS
- How to input plot data into highcharts with rails
- Highcharts - how to create multiple y axis and group the data series
- How to align Highcharts datetime x-axis with data I pass to it?
- HighCharts & MVC: How to load whole graph definition and data with JSON?
- How to use Highcharts React to create chart with multiple lines for same XAxis?
- Exporting with custom data label image in highcharts gantt
- How to create data in Json format for highcharts
- How to create a single series bar graph with Highcharts
- how to create highcharts formatted json structure with python
- Highcharts bar with negative stack: how to position data labels
- How to specify a range of data when using HighCharts with <table>?
More Query from same tag
- HighCharts Multi Color
- Dynamically high chart rendering not working
- Threshold value change on click of rangeSelector in HighStock graph
- Highcharts: Format series names in tooltip
- insert block of text after chart
- highchart cannot addSeries
- Highcharts column change color, but marker/dot not changing
- how to create a world map using highmaps and disable part of legend?
- Highcharts Sync charts vertically
- Highcharts fill serie's color on svg marker
- Highcharts - Adding a suffix to a tooltip in a multi-series chart
- Angular. Highcharts. Column Chart. Positioning of Columns on X-Axis
- Highcharts set percent to datatable
- Javascript not working after renaming asp.net page
- How to provide styles on X axis gantt high chart
- How to show gridlines only on 0 on the yAxis in highcharts?
- width for the Highcharts/Highstock Export
- Setting a custom variable in Highcharts
- Is it possible to use custom fonts in Highcharts?
- How to export a Highchart chart to PDF thanks to a button outside the chart?
- Highcharts - resize legend on chart resize?
- How to give specific color to particular range in 3D scatter graph using Highcharts?
- Highcharts - programmatically "flip" (reverse) Y Axis
- Highstock columnrange data grouping values not consistent
- PHP array to Highcharts
- Combination of ohlc and line plot in highchart
- Angular - Higchart doesn´t wait to ngOnInit
- How to convert xts object in JSON in R?
- How to add new chart(any charts, highcharts or d3 charts) in Serenity admin dashboard
- How to make podium with highchart