score:9
Actually, you can do exactly what you want out of the box. The chosen answer was only looking at events for the PlotOptions object; you need to look at events for the Chart object.
Documentation and example at: http://www.highcharts.com/ref/#chart-events--click
When you click on the background, it fires the event.
chart: {
renderTo: 'container',
events: {
click: function(event) {
alert ('x: '+ event.xAxis[0].value +', y: '+
event.yAxis[0].value);
}
}
},
score:2
You can use the click chart event when clicking on the plot background, like so:
$(function () {
// create the chart
var chart = new Highcharts.Chart({
chart: {
renderTo: 'container',
events: {
click: function(event) {
alert ('x: '+ event.xAxis[0].value +', y: '+
event.yAxis[0].value);
}
}
},
xAxis: {
},
series: [{
data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
}]
});
});
Here's the link to the documentation:
http://www.highcharts.com/ref/#chart-events--click
Hope that helps.
score:3
According to the highcharts documentation, the click
event only covers clicking on the series itself, so it will not register click events for clicking beneath the line.
To do what you want, you may need to handle things on your own by using the mouseOver
event. Unforutnately, this event fires when the mouse hovers over the graph, which would mean you'd need to figure out where the mouse is on the graph and so forth.
Alternatively, you could modify the highcharts source code to suit your needs, or extend it, but in any case, I do not believe that this can be done easily.
score:11
You can use this trackByArea: true
area function in plotOptions
trackByArea: Boolean
Since 1.1.6 Whether the whole area or just the line should respond to mouseover tooltips and other mouse or touch events. Defaults to false.
Combine this with the click event
click: Function
Fires when the series is clicked. The this keyword refers to the series object itself. One parameter, event, is passed to the function. This contains common event information based on jQuery or MooTools depending on which library is used as the base for Highcharts. Additionally, event.point holds a pointer to the nearest point on the graph.
ex:
plotOptions: { area: { **trackByArea: true**, marker: { enabled: false },..
Source: stackoverflow.com
Related Query
- How do I increase the clickable area of a point in Highcharts so that whenever the point is 'active' a click can be recorded?
- Highcharts Area graph, use 2 fill colors above / below X axis
- Highcharts area fillOpacity do not work when changing the color
- Highcharts: Area clickable
- Can highcharts crosshairs show on top of area chart fill?
- Change color of area chart programmatically in highcharts
- Highcharts highlight area between two lines
- Highcharts - How can I remove starting and ending padding from area chart
- Highcharts - Provide URL's for series data to open clickable link
- Highcharts Area Chart - Specifying Area Color
- Highcharts chart going blank on zoomType: 'x' area range zoom?
- Using PhantomJS to create HighCharts grahps server side for use in PDF creation (PHP) - results in exit code 11 from PHPs exec();
- Highcharts - Bar - Setting the X axis width and the chart area width to be constant
- Highcharts 3.0, area chart with stacked and unstacked series - how to fix?
- Highcharts - Global configuration with common code and unique data & Headings
- Highcharts area spline values have incorrect position on y-axis
- Highcharts clickable column to open another page on same site
- Highcharts Area Range Plot in rCharts
- Clickable link in tooltip of Highcharts
- How to change area graph color above certain value in Highcharts
- Highcharts - areaspline with negative values, area should be always at the bottom
- HighCharts area graph - show tooltip only on hover of marker
- Highcharts - Remove first marker from Area chart in every series
- Highcharts - Area between two y values highlighted
- Highcharts - Area Chart - Stacking with series containing negative and positive values
- Highcharts - null values are plotted on stacked area chart, in latest version
- Highcharts change the line color if its out of the area range
- How to keep an empty slice area in highcharts after clicking on legendItem
- highcharts - changing color of area depending on y-value
- Angular Highcharts Custom Legend Label In Area Chart
More Query from same tag
- POST parameters for the Highcharts export server causes 407 Proxy Authentication Error
- Highcharts - x-axis label disappears for polar chart with any endAngle
- How to create Waterfall model chart using QuickChart?
- Plot series that cannot be sorted avoiding Highcharts error 15
- Changing a Highcharts theme (partially working)
- highcharts - Hide some labels in yAxis
- Plots in Child Rows of an R/Shiny DT::DataTable
- Loading several large dataset in Highcharts
- Increasing the length of widgetboxes sDashboard
- How to show custom text inside of each point in highchart gantt?
- Highchart - How do I create the attached image gauge within a semicircle
- Highstock - flag text appears on top of the tooltip
- Highcharts showing December instead of November in x-axis
- Highstock charts - change position of rangeselector From and To inputs
- Highcharts Maps - Rounded zoom buttons
- Highchart grouped column with drill down
- How to filter Date (Year) in shiny based on sliderInput choice?
- Highchart Gantt chart Navigator color
- Highcharts: Corner radius for plot border
- SVG javascript chart scraping
- angularjs & highcharts - setting up properties in directive
- How do I reset Highcharts bar color back to it's original color?
- How can i add time to xAixs of a ColumnRange Chart in HighChart?
- Change color of the values in heatmap or remove the values in highcharter R package
- Highcharts. Pie chart. DataLabels formatter
- Highcharts Error 13 on Ajax Result and Dynamic Div
- Internationalization in highcharts?
- Highcharts y axis and x axis display
- adding new points in a scatter plot
- one chart, multiple series multiple data with single data