在我的php页面中,我有values..For的下拉列表,每选择一个值,我就必须为所选值显示一个饼图。我使用phplot.php来绘制饼图。
我们有setDataColor()函数来设置颜色或默认colors.But下拉列表中的每个值都有相同的数据,但不同的numbers.For示例。
Dropdown values:student1,student2,student3在数据库中,
student1:**subj** **marks**
eng 10
maths 0
sci 30
student2: eng 20
sci 40
student3: maths 50 我想要英文-‘红’,数学-‘绿’,科学-‘蓝’的颜色
如果我们使用phplot函数(setDatacolor()),我们可以将颜色作为数组(红、绿、蓝)传递。.This不会为student2和student3饼图提供所需的输出,因为它只遵循顺序。
但我希望每次数学都是绿色的,sci是蓝色的,以此类推。
有没有办法做到这一点?
发布于 2015-09-10 17:17:36
如下所示:
如下所示,在更改dropdown时调用函数(要发送的dropdown值)
var chart_data = getChartData( Student, EngMarks, mathsMarks, scienceMarks);
var chart = new Highcharts.Chart( chart_data );
xAxis : {
categories : [
'English',
'Maths',
'Science',
] },
series : [ { type : 'pie',
name : Student,
data : [
{
name : 'English',
y : EngMarks,
color : 'Red'
},
{
name : 'Maths',
y : mathsMarks,
color : 'green'
},
{
name : 'Science',
y : scienceMarks,
color : 'blue'
} ]
} ]https://stackoverflow.com/questions/32495021
复制相似问题