我试图将折线图放置在轴的起点。并按日期指示具体位置。该图表已显示,但非常奇怪。它不缩放。
Highcharts.stockChart('container', {
xAxis: {
min: Date.UTC(2010, 0, 1),
max: Date.UTC(2010, 1, 1),
type: 'datetime',
pointStart: Date.UTC(2009, 0, 1),
tickInterval: 3600 * 1000,
startOnTick: false
},
series: [{
name: 'test',
data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4],
pointStart: Date.UTC(2010, 0, 5),
offset: 100,
tickInterval: 3600 * 1000,
pointInterval: 3600 * 1000
}]
});
<script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
<!--<script src="https://code.highcharts.com/highcharts.js"></script>-->
<link rel="stylesheet" href="https://code.highcharts.com/css/highcharts.css">
<script src="https://code.highcharts.com/stock/js/highstock.js"></script>
<script src="https://momentjs.com/downloads/moment.js"></script>
<script src="https://momentjs.com/downloads/moment-timezone-with-data.min.js"></script>
<div id="container" style="width:100%; height:600px;"></div>
如何解决?
[JS Fiddle][1]
[1]: https://jsfiddle.net/6orqa0ym/
答案 0 :(得分:1)
高位股票图表默认情况下为ordinal
启用了xAxis
选项,这给您带来不便。您可以轻松禁用该选项:
xAxis: {
...,
ordinal: false
},