English 中文(简体)
高档:更新附有地图的皮图
原标题:Highcharts: Updating a Pie Chart with setData()

我正试图研究如何更新高光谱图表,但对于我来说,这似乎无法使其发挥作用。

我对这些文件进行了研究,并且能够获得一张巴条、线和间谍图,以更新罚款,但在利用这一功能绘制图表时,它并不奏效。

我现在谈谈:

item.setData([["none", 100]], true);

在项目等同的情况下:

$.each(browser_chart.series, function(i, item){
    if(item.name ==  Browser share ){
        console.log(data.browsers);
        item.setData([["none", 100]], true);
    }
});

白蚊中显示的,是如何编排皮图的数据。 问题似乎是不能正确阅读系列。 我尝试:

item.setData(["none", 100], true);

而且,它似乎做了一些事情,但不能读到x和等值的权利(这当然意味着它是错误的)。

在这里,有人会向我指出,要让我从事这项工作?

感谢

最佳回答

Edited:
When you set a new data you have to set as array of arrays for all pie parts in this case.
In my Example I have six categories, so I ve to set data for all of them.

因此,在这种情况下,你必须做如下事情:

var seriesData = [];
$.each(browser_chart.series, function(i, item) {
    if(item.name ==  Browser share ){
        seriesData.push(["serie"+i, someNumber]);
    }
});
chart.series[0].setData(seriesData, true);
问题回答

然而,我对Ricardos的答复作了说明,但我提出的问题涉及更多的问题,我没有适当解释。

我正在通过日本宇宙航空研究开发机构更新由PHP Backend产生的日本宇宙航空研究开发公司编制的地图。 当我把新数据应用到图表时,就会中断。

借助Ricardos的答复,我发现,这是因为我有不同的观点,因此我不能仅仅更新我必须做这样的改动:

browser_chart_config.series[0].data = data.browsers;
browser_chart = new Highcharts.Chart(browser_chart_config);

这将使你能够在有不同要点时更新图表。

希望会提供帮助,

EDIT:我还发现,这是一个众所周知的问题,涉及高Charts:

 //initialise
        var new_data;
            new_data = [{ name:  load percentage , y: 10.0, color:  #b2c831  },{ name:  rest , y: 60.0, color:  #3d3d3d  }];
	function requestData() 
        {             
			$.ajax({
				url:  live-server-data.php , 
				success: function(point) 
                                {
					var series = chart.series[0];
                                        var y_val = parseInt(point[1]);                                      
                                        var x_val = 100 - y_val;
                                        console.log(point[0]+ "," +point[1] );//["0"]
                                        new_data = [{ name:  load percentage , y:y_val, color:  #b2c831  },{ name:  rest , y:x_val, color:  #3d3d3d  }];                                                                
                                        series.setData(new_data);                                   
                                        // call it again after one second					
				},
				cache: false
			});
	}
			




相关问题
JQuery/MVC Search Issue

I have inherited a piece of work where the entry screen shows a summary of 20 calculated variables. E.g. Var A (250), Var B (79). Clicking on any of these links takes the user to a view with a ...

jQuery quicksearch plug-in tinkering with JSON

I ve implemented the quicksearch plugin by Rik Lomas and I love it for an application in a custom CMS I m building. I was wondering though, since I m going to have a bizillion items in the table if ...

JSON with classes?

Is there a standardized way to store classes in JSON, and then converting them back into classes again from a string? For example, I might have an array of objects of type Questions. I d like to ...

PHP json_decode question

i m trying to use json_decode to combine a few json objects and then re-encode it. my json looks like: { "core": { "segment": [ { "id": 7, "...

Converting JSON data to Java object

I want to be able to access properties from a JSON string within my Java action method. The string is available by simply saying myJsonString = object.getJson(). Below is an example of what the string ...

热门标签