Blo*_*lob 10 javascript highcharts
我正在使用HighCharts作为折线图,我正在尝试更改每个系列的线条颜色.我确实在这里找到了这个例子,但数据是硬编码的.我的数据是从Sql数据库中提取的,并使用一些VB代码传递给HTML页面.
var chart;
$(document).ready(function () {
chart = new Highcharts.Chart({
chart: {
renderTo: 'container',
defaultSeriesType: 'column'
},
title: {
text: 'Chart Title'
},
subtitle: {
text: 'Chart subtitle'
},
xAxis: {
categories: [<%= GraphDate %>]
,
labels:
{
rotation: -45,
align: 'right',
style:
{
}
}
},
yAxis: {
min: 160,
title: {
text: 'Temp'
}
},
legend: {
layout: 'vertical',
backgroundColor: '#FFFFFF',
align: 'left',
verticalAlign: 'top',
x: 400,
y: 0,
floating: true,
shadow: true
},
tooltip: {
formatter: function () {
return '' +
this.x + ': ' + this.y + ' ºC';
}
},
plotOptions: {
column: {
pointPadding: 0.2,
borderWidth: 0
}
},
series:
[<%= GraphSeries %>],
});
Run Code Online (Sandbox Code Playgroud)
我尝试使用其他帖子设置样式但是它无法生成图表.但主要的问题是,线图有两个系列,所以下面的方法会设置我假设的两个系列的颜色?那么,我可能需要以某种方式在我的vb代码中格式化该系列吗?
series: [{
color: 'yellow',
data: [
[<%= GraphSeries %>]
]},
Run Code Online (Sandbox Code Playgroud)
编辑:
$(document).ready(function () {
chart = new Highcharts.Chart({
colors: ['#4572A7', '#AA4643', '#89A54E', '#80699B', '#3D96AE', '#DB843D', '#92A8CD', '#A47D7C', '#B5CA92']
chart: {
renderTo: 'container',
defaultSeriesType: 'column'
}
Run Code Online (Sandbox Code Playgroud)
Ser*_*sev 26
顶级配置可以包含colors字段.这是一个从中挑选系列颜色的数组.
看到这里.
这是我项目的工作内容
var chart;
$(document).ready(function () {
chart = new Highcharts.Chart({
chart:{
renderTo:'perfchart',
type:'line',
marginRight:130,
marginBottom:25
},
colors: ['#0000FF', '#0066FF', '#00CCFF'],
title:{
text:'Historical system performance',
x:-20 //center
},
Run Code Online (Sandbox Code Playgroud)
出现:

| 归档时间: |
|
| 查看次数: |
41353 次 |
| 最近记录: |