Jquery 如何自动查找打开、高、低和关闭值并显示烛台和ohlc图表
我有以下代码。哪个类型按钮的想法借鉴了这个 我的javascript代码:Jquery 如何自动查找打开、高、低和关闭值并显示烛台和ohlc图表,jquery,html,highcharts,highstock,Jquery,Html,Highcharts,Highstock,我有以下代码。哪个类型按钮的想法借鉴了这个 我的javascript代码: $(function () { $.getJSON('http://www.highcharts.com/samples/data/jsonp.php?filename=aapl-ohlc.json&callback=?', function (data) { Highcharts.setOptions({ global: {
$(function () { $.getJSON('http://www.highcharts.com/samples/data/jsonp.php?filename=aapl-ohlc.json&callback=?', function (data) {
Highcharts.setOptions({
global: {
timezoneOffset: 7 * 60
}
});
// Create the chart
var end = 1363935600000;
var chart = new Highcharts.StockChart({
chart: {
renderTo: 'container'
},
title: {
text: 'AAPL Stock Price'
},
rangeSelector: {
inputEnabled: false,
selected: 0,
buttonTheme: {
width: null
},
buttons: [{
type: 'day',
count: 6,
text: 'past 7 days'
}, {
type: 'day',
count: 14,
text: 'past 15 days'
}, {
type: 'day',
count: 29,
text: 'past 30 days'
}, {
type: 'day',
count: 59,
text: 'past 60 days'
}, {
type: 'day',
count: 179,
text: 'past 180 days'
}]
},
xAxis: {
max: end,
type: 'datetime',
minTickInterval: 24 * 3600 * 1000
},
navigator: {
enabled: false
},
scrollbar: {
enabled: false
},
series: [{
name: 'AAPL',
data: data,
tooltip: {
valueDecimals: 3
}
}]
});
// Toggle point markers
var enableMarkers = true;
$('#markers').click(function () {
chart.series[0].update({
marker: {
enabled: enableMarkers,
radius: 5,
fillColor: '#0000FF'
}
});
enableMarkers = !enableMarkers;
});
// Toggle point markers
var color = false;
$('#color').click(function () {
chart.series[0].update({
color: color ? null : Highcharts.getOptions().colors[1]
});
color = !color;
});
// Set type
$.each(['line', 'spline', 'area', 'areaspline', 'candlestick', 'ohlc'], function (i, type) {
$('#' + type).click(function () {
chart.series[0].update({
type: type
});
});
});
});
});
我的html代码:
<script src="http://code.highcharts.com/stock/highstock.js"></script>
<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="http://code.highcharts.com/stock/modules/exporting.js"></script>
<script src="http://code.highcharts.com/modules/exporting.js"></script>
<div id="container" style="height: 400px; min-width: 600px"></div>
<button id="markers">Toggle point markers</button>
<button id="color">Toggle color</button>
<button id="line" style="margin-left: 2em">Line</button>
<button id="spline">Spline</button>
<button id="area">Area</button>
<button id="areaspline">Area spline</button>
<button id="ohlc">OHLC</button>
<button id="candlestick">Candlestick</button>
如何显示烛台和ohlc图表?谢谢 从中获取JSON文件并将其保存在本地计算机上,这样可能会有效!即使我将json文件更改为本地文件,它仍然无法在chrome中显示图表。现在firefox无法在HighStocks中显示烛台和OHLC类型。您在控制台中是否有任何错误?我认为您缺少jquery版本文件!在本地html中,我包括jquery版本文件。在JSFIDLE中,我不必包括
1279695600000 685
1279782000000 1123
1279868400000 666
1279954800000 166
1280041200000 84
1280127600000 302
1280214000000 492
1280300400000 571
1280386800000 602
1280473200000 583
1280559600000 570
1280646000000 493
1280732400000 685
1280818800000 702
1280905200000 549