我的数据来自背后代码的数据表。我正在重绘图表以显示新数据,但是在重绘数据时是否可以更改 y 轴?
代码:
function draw(d) {
var testarray = JSON.parse(a);
var testarray1 = JSON.parse(a1);
var testarray2 = JSON.parse(a2);
if (d == 1)
{
var c = testarray
}
else if (d == 2)
{
var c = testarray1
}
else if (d == 3)
{
var d = testarray
}
else if (d == 4)
{
var d = testarray1
}
else if (d == 5) {
var d = testarray1
}
else if (d == 6) {
var d = testarray1
}
$(function() {
$('#container1').highcharts({
chart: {
type: 'column'
},
credits: {
enabled: false
},
title: {
text: 'Consumption by months'
},
xAxis: {
categories: array3
},
yAxis: {
title: {
text: 'kWh'
}
},
tooltip: {
valueDecimals: 2
},
plotOptions: {
type: 'column'
},
series: [{
name: '2011-2012',
type: 'column',
color: '#0000FF',
data: testarray
},
{
name: '2012-2013',
type: 'column',
color: '#92D050',
data: testarray1
}]
});
});
}
所以我需要的是在调用该数据时在 testarray 的 y 轴上显示一些东西。在这种情况下 c 和 d。
代码背后
Case 1
For Each row In Year1
testarray.Add(row("data"))
Next row
For Each row In Year2
testarray1.Add(row("data"))
Next row
For Each row In Year3
testarray2.Add(row("data"))
Next row
Dim serializer1 As New JavaScriptSerializer()
Dim arrayJsonTest1 As String = serializer1.Serialize(testarray)
Dim arrayJson11 As String = serializer1.Serialize(testarray1)
Dim arrayJson12 As String = serializer1.Serialize(testarray2)
hidden.Value = arrayJsonTest1
hidden1.Value = arrayJson11
hidden2.Value = arrayJson12
ScriptManager.RegisterStartupScript(Me.Page, Me.GetType, "draw", "javascript:draw(1);", True)