简体   繁体   English

Highcharts动态将JSON数据拉入系列名称

[英]Highcharts Pulling JSON data into series names dynamically

Ok, so here is my problem. 好的,这是我的问题。 I am building a scatter plot chart with 4 quadrants that are labeled. 我正在构建带有4个象限的散点图。 However I need to pull JSON data into the chart and dymanically label the series instead of how I have it now. 但是,我需要将JSON数据拖入图表并动态标记该系列,而不是现在的方式。

https://jsfiddle.net/oh3hevwr/5/ https://jsfiddle.net/oh3hevwr/5/

In other words, I need this code specifically to be populated by the JSON data. 换句话说,我需要此代码专门由JSON数据填充。 I know how to pull in the JSON data, but not how to bring in the series name, color, and id within the string. 我知道如何提取JSON数据,但不知道如何在字符串中引入系列名称,颜色和ID。

series: [{
            name: 'Properly Used',
            color: '#23d207',
            id: 1,
            data: []...etc.

Any help would be appreciated. 任何帮助,将不胜感激。

jQuery makes this very easy. jQuery使这非常容易。

http://api.jquery.com/jquery.getjson/ http://api.jquery.com/jquery.getjson/

You'll want to make it so that the chart does not instantiate until your AJAX call has completed successfully. 您需要这样做,以使图表不会实例化,直到您的AJAX调用成功完成。 Wrap that code into a function that accepts a series parameter, and then call it with JSON data obtained through the jQuery getJSON function to render the highchart with your information. 将该代码包装到可以接受series参数的函数中,然后使用通过jQuery getJSON函数获得的JSON数据进行调用,以用您的信息呈现高位图表。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM