在我的php页面中,我有下拉值列表。对于每个值的选择,我必须显示所选值的饼图。我使用phplot.php绘制饼图。
我们有setDataColor()函数来设置颜色或默认颜色。但是下拉列表中的每个值都有相同的数据,但数字不同。例如,
Dropdown values:student1,student2,student3
在数据库中,
student1:**subj** **marks**
eng 10
maths 0
sci 30
student2: eng 20
sci 40
student3: maths 50
我想要颜色作为英文 - '红色',数学 - '绿色',sci - '蓝色'
如果我们使用phplot函数(setDatacolor()),我们可以将颜色作为数组(红色,绿色,蓝色)传递。这不会给student2和student3饼图的欲望输出,因为它只遵循顺序。
但我希望每次数学都是绿色,sci是蓝色等等。
有没有办法做到这一点?