我正在开发高级图表api。我想以不同颜色显示每列的可能性。下面是图表的代码和屏幕截图
在此图像中,每列都显示黑色但我想要各自不同的颜色。我给出了一系列颜色,但它只选择了第一个颜色
$(function () {
$('#pak_med').highcharts({
chart: {
type: 'column'
},
colors: ['#000000', '#0066FF', '#00CCFF'],
title: {
text: [ <?php
$query = mysqli_query($connection," select distinct d ,med, c,country_name from
(select date_format(apdate,'%Y') as d,doc_country as country_name,
med,count(med) as c from view_doc_prescriptions where doc_countryId={$_GET['country']} group by med, d)f
group by d order by d desc ;
") or die("date created error");
//$total=0;
$info = mysqli_fetch_array($query);
// echo $info['spec'];
echo "'";
echo "Top Medicine in ".$info['country_name'];
echo "'";
echo ',';
?>]
},
xAxis: {
categories: [ <?php
$query = mysqli_query($connection," select distinct d ,med, c,country_name from
(select date_format(apdate,'%Y') as d,doc_country as country_name,
med,count(med) as c from view_doc_prescriptions where doc_countryId={$_GET['country']} group by med, d)f
group by d order by d desc ;
") or die("date created error");
//$total=0;
while($info = mysqli_fetch_array($query))
{
// echo $info['spec'];
echo "'";
echo $info['d'];
echo " ";
echo $info['med'];
echo "'";
//echo $info['spec'];
echo ',';
}
?>]
},
credits: {
enabled: false
},
series: [{
name: 'Top Medicine',
data: [ <?php
$query = mysqli_query($connection," select distinct d ,med, c,country_name from
(select date_format(apdate,'%Y') as d,doc_country as country_name,
med,count(med) as c from view_doc_prescriptions where doc_countryId={$_GET['country']} group by med, d)f
group by d order by d desc;
") or die("date created error");
//$total=0;
while($info = mysqli_fetch_array($query))
{
// echo $info['spec'];
echo $info['c'];
//echo $info['spec'];
echo ',';
}
?>]
}]
});
});
答案 0 :(得分:1)
添加此行
series:[{
colorByPoint: true,
}]