更改高图中每列的颜色
Changing the color of each column in high charts
我正在处理高图表api.I 想用不同的颜色显示每一列,这怎么可能。以下是图表的代码和屏幕截图
在这张图片中,每一列都显示为黑色,但我希望每一列都显示不同的颜色。我给出了一组颜色,但它只选择了第一个
$(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 ',';
}
?>]
}]
});
});
添加这一行
series:[{
colorByPoint: true,
}]
我正在处理高图表api.I 想用不同的颜色显示每一列,这怎么可能。以下是图表的代码和屏幕截图
在这张图片中,每一列都显示为黑色,但我希望每一列都显示不同的颜色。我给出了一组颜色,但它只选择了第一个
$(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 ',';
}
?>]
}]
});
});
添加这一行
series:[{
colorByPoint: true,
}]