如何从高库存图表中提取数据 [英] How to extract the data from highstock chart

查看:130
本文介绍了如何从高库存图表中提取数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我在网站上有一个示例高库存图表,例如.我想知道是否有可能仅从图表中提取数据(即图表是由第三人创建的,其他人无法访问用于图表的数据).

Assume that I have a sample highstock chart like this in the website. I was wondering whether it is possible to extract the data from the chart alone (i.e. chart is created by the third person and the data used for the chart is not accessible to others).

<img src="http://www.highcharts.com/stock/demo/basic-line">

推荐答案

是的.每个图表都存储在HighChart的Highcharts.charts数组中.在您所链接的页面上,当前包含一个图表:

Yep. Each chart is stored within HighChart's Highcharts.charts array. On the page you've linked that currently contains the one chart:

Highcharts.charts
-> [ z.Chart ]

这是一个包含该图表内所有数据的对象.我们可以通过从Highcharts.charts数组索引(在本例中为0)中选取它来查看它:

This is an object containing all the data within that chart. We can view it by picking it from the Highcharts.charts array index (0 in this case):

Highcharts.charts[0]
-> z.Chart { ... }

其中包含您需要的所有信息.每个图表对象都包含一个series属性,该属性是一个数组,其中包含图表呈现的每个系列的数据.每个系列中都有一个data属性,其中包含其中的所有数据,而name属性则包含该系列的名称.

This contains all the information you'd need. Each chart object contains a series property which is an array containing the data for each of the series the chart renders. A data property exists within each series containing all the data within, and the name property contains the name of the series.

例如:

Highcharts.charts[0].series[0].name
-> "APPL"

Highcharts.charts[0].series[0].data
-> Array[1774]

HighCharts的文档的格式与其创建的JavaScript对象的格式相同.可以在此处查看: http://api.highcharts.com/highcharts .

HighCharts' documentation is laid out in the same format as the JavaScript object it creates. This can be viewed here: http://api.highcharts.com/highcharts.

这篇关于如何从高库存图表中提取数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆