我正在尝试在我的Visual Studio 2017中http://jsfiddle.net/katalin_2003/2xomxL2t/处提到的Highcharts示例,其中包含该链接上提及的所有代码,但图表未显示。以下是我完整的代码。
<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="http://code.highcharts.com/highcharts-more.js"></script>
<script src="http://code.highcharts.com/modules/solid-gauge.js"></script>
<script src="Scripts/jquery-2.1.0.min.js"></script>
<div style="width: 600px; height:60px; margin: 0 auto">
<div id="container-speed" style="width: 200px; height: 200px; float: left"></div>
<div id="container-rpm" style="width: 200px; height: 200px; float: left"></div>
</div>
<script >
$(function () {
var gaugeOptions = {
chart: {
type: 'solidgauge'
},
title: null,
pane: {
center: ['50%', '50%'],
size: '100%',
startAngle: 0,
endAngle: 360,
background: {
backgroundColor: (Highcharts.theme && Highcharts.theme.background2) || '#EEE',
innerRadius: '80%',
outerRadius: '100%',
shape: 'arc'
}
},
tooltip: {
enabled: false
},
// the value axis
yAxis: {
stops: [
[0.85, '#DF5353'], // red
[0.90, '#DDDF0D'], // yellow
[0.95, '#55BF3B'] // green
],
lineWidth: 0,
minorTickInterval: null,
tickPixelInterval: 400,
tickWidth: 0,
title: {
y: -70
},
labels: {
enabled: false,
y: 10
}
},
plotOptions: {
solidgauge: {
innerRadius: '80%',
dataLabels: {
y: -20,
borderWidth: 0,
useHTML: true
}
}
}
};
// The speed gauge
$('#container-speed').highcharts(Highcharts.merge(gaugeOptions, {
yAxis: {
min: 0,
max: 100,
title: {
text: 'Speed'
}
},
credits: {
enabled: false
},
series: [{
name: 'Speed',
data: [0], // set initial value to 0 and animate later with real values
dataLabels: {
format: '<div style="text-align:center"><span style="font-size:25px;color:' + ((Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black') + '">{y} %</span><br/>'
/*+
'<span style="font-size:12px;color:silver">km/h</span></div>'*/
}
/*,
tooltip: {
valueSuffix: ' %'
},*/
}]
}));
// The RPM gauge
$('#container-rpm').highcharts(Highcharts.merge(gaugeOptions, {
yAxis: {
min: 0,
max: 100,
title: {
text: 'RPM'
}
},
credits: {
enabled: false
},
series: [{
name: 'RPM',
data: [0], // set initial value to 0 and animate later with real values
dataLabels: {
format: '<div style="text-align:center"><span style="font-size:25px;color:' + ((Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black') + '">{y:.1f} %</span><br/>'/* +
'<span style="font-size:12px;color:silver">* 1000 / min</span></div>'*/
},
tooltip: {
valueSuffix: ' revolutions/min'
}
}]
}));
// Animate the gauges with true values
// Speed
var chart = $('#container-speed').highcharts(),
point;
if (chart) {
point = chart.series[0].points[0];
point.update(90); // This is the real value
}
// RPM
var chart = $('#container-rpm').highcharts(),
point;
if (chart) {
point = chart.series[0].points[0];
point.update(61); // This is the real value
}
});
</script>
也请注意,我已经使用nuget Manager安装了适当版本的jquery,并且我也尝试使用jquery cdn来做到这一点。但是没有一个