score:2
the highchart data is converted to an svg path, so you'd have to interpret the path yourself. i'm not sure why you would want to do this, actually: in general you can trust 3rd party libraries to work as advertised; the testing of that code should reside in that library.
if you still want to do it, then you'd have to dive into javascript to retrieve the data. taking the highcharts demo as an example, you can extract the data points for the first line as shown below. this will give you the svg path definition as a string, which you can then parse to determine the origin and the data points. comparing this to the size of the vertical axis should allow you to calculate the value implied by the graph.
# get the origin and datapoints of the first line
s = selenium.get_eval("window.jquery('svg g.highcharts-tracker path:eq(0)')")
splitted = re.split('\s+l\s+', s)
origin = splitted[0].split(' ')[1:]
data = [p.split(' ') for p in splitted[1:]]
# convert to floats
origin = [float(origin[1]), float(origin[2])]
data = [[float(x), float(y)] for x, y in data]
# get the min and max y-axis value and position
min_y_val = float(selenium.get_eval( \
"window.jquery('svg g.highcharts-axis:eq(1) text:first').text()")
max_y_val = float(selenium.get_eval( \
"window.jquery('svg g.highcharts-axis:eq(1) text:last').text()")
min_y_pos = float(selenium.get_eval( \
"window.jquery('svg g.highcharts-axis:eq(1) text:first').attr('y')")
max_y_pos = float(selenium.get_eval( \
"window.jquery('svg g.highcharts-axis:eq(1) text:last').attr('y')")
# calculate the value based on the retrieved positions
y_scale = min_y_pos - max_y_pos
y_range = max_y_val - min_y_val
y_percentage = data[0][1] * 100.0 / y_scale
value = max_y_val - (y_range * percentage)
disclaimer: i didn't have to time to fully verify it, but something along these lines should give you what you want.
Source: stackoverflow.com
Related Query
- Test Highcharts with selenium webdriver
- Highcharts - Global configuration with common code and unique data & Headings
- Testing Highcharts with selenium
- How to grab correct highchart number in selectors using Selenium Webdriver with Python with several charts on the page?
- How to read and insert correct highchart number in selectors using Selenium Webdriver with Python?
- passing formatting JavaScript code to HighCharts with JSON
- Error scraping Highcharts in Python with selenium
- Highcharts series visibility with csv data source
- How to have multiple highcharts with different series data in vuejs without repeating code
- Is there any way to test the highcharts with large data-set with Jest and React.?
- Why code of Horizonal line(y-axis) on a single in Highcharts get applied to all other charts integrated with Webdatarocks
- Highcharts cloud issue with data source when duplicating chart
- Getting numbers on Y-axis to show up as percentages with code from a Highcharts code generator tool?
- Highcharts code with same set of code/data works in PHP but does not work in JSfiddle
- Reload chart data via JSON with Highcharts
- Highcharts - how to have a chart with dynamic height?
- Resize height with Highcharts
- Styling bar colors in Highcharts with a gradient issue
- How to use highcharts with angular 5?
- Loading Highcharts with require.js
- dealing with highcharts bar chart with really long category names
- Handling unix timestamp with highcharts
- Displaying hours and minutes on x-axis with Highcharts
- Highcharts - Keep Zero Centered on Y-Axis with Negative Values
- Resize data points with highcharts
- How to include highcharts with bower?
- Highcharts doesn't display series with lots of data points
- HighCharts - two Y-axis, one with max value
- how to import highcharts with webpack and babel
- Type 'number[]' has no properties in common with type 'XrangePointOptionsObject' in Angular8 using Highcharts
More Query from same tag
- How to render a chart using highstocks in highcharts in angular 6?
- Vue.js - Highmaps - Redraw map on series change
- How can I highlight selected label in HIghcharts Timeline?
- Unable to set gape in Gauge Highchart
- Border on selected series in Stacked Bar charts + High Charts
- How to Draw graph in ASP.NET MVC 4 using High-Charts?
- Making a node_module global using Webpack 2
- Change color of different points in same series Highcharts
- How to call another function on changing the time range selector and date selector in Highcharts stock?
- HighCharts: column grouped drill down
- Data label not showing in some pie chart handles Highchart
- Create a highchart for every dataset in R
- how to show column and area charts with different y axis with same category and same x axis in highcharts
- Having Several Units on Highcharts Spiderweb
- How to set y-axis in HighChart?
- Build empty chart and then set it's data
- Highcharts - Heatmap - Legend remove white "dashes"
- Grid (gridlines) in Highcharts line chart
- How to manually trigger the afterSetExtremes event from a series click event in HighCharts
- highcharts - donut chart - Labels inside and outside
- Stacking Highcharts data in an xrange data series
- Highchart's selection-function updating with delay
- highchart activity gauge chart using json data from a file
- How to extract the data from highstock chart
- Highcharts - Space between bars based on the bars' width
- Refresh an Angular page (controller $scope, directive $scope) to emulate a first load of a page not $window.location.reload
- Highchart, how to add commas to point data in tooltips
- Rails 4.1 Error Loading Chart: No adapter found highcharts
- Show details in Fancybox with Highcharts
- Highcharts enable pan without holding panKey