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
- Highcharts: Flush chart against the sides
- Unable to attach a highstock to a div
- How can I style highchart select to look like hover?
- highchart with dual axis breakpoint and drag point
- Remove title based on viewport width
- highcharts: how insert a fix label on a chart
- Sync an html5 video with an highchart.js line chart
- How can I disable tooltips during selection?
- how to control orders of charts in highcharts combination charts?
- Highcharts change dataLabel option 'inside' by function
- Unable to update datatable in Highcharts
- iOS Integrating highcharts
- Can packed bubble while including Highcharts Gantt resource?
- Highcharts if title contains number it shows invalid data
- Mouse out event on highcharts
- How to remove additional number appear in x-axis Highchart
- Highcharts title text with two dynamic dates
- How to include strings in series data to pull for tooltip point formatting?
- Charting with 500K data points
- When adding a point to a series, the marker does not display (It's hidden by other area splines)
- Highcharts Gauge - how to read input from file?
- Highcharts update graph from array data
- Show special symbol for each series in category in highcharts
- Highcharts - accessing overlaying data points
- PhantomJS PDF DPI scaling issues
- console error when changing line color in a HighCharts scatterplot
- How to plot x axis next to 0th y axis tick label in case of negative data?
- Highcharts series names in datalabel
- Highcharts labels cut off
- How to set up zoomType for Highcharts with the CodeIgniter lib