JS:
var dataSource = [
{date: new Date(1994,2,1), low: 24.00, high: 25.00, open: 25.00, close: 24.875},
{date: new Date(1994,2,2), low: 23.625, high: 25.125, open: 24.00, close: 24.875},
{date: new Date(1994,2,3), low: 26.25, high: 28.25, open: 26.75, close: 27.00},
{date: new Date(1994,2,4), low: 26.50, high: 27.875, open: 26.875, close: 27.25},
{date: new Date(1994,2,7), low: 26.375, high: 27.50, open: 27.375, close: 26.75},
{date: new Date(1994,2,8), low: 25.75,high: 26.875, open: 26.75, close: 26.00},
{date: new Date(1994,2,9), low: 25.75, high: 26.75, open: 26.125, close: 26.25},
{date: new Date(1994,2,10), low: 25.75, high: 26.375, open: 26.375, close: 25.875},
{date: new Date(1994,2,11), low: 24.875, high: 26.125, open: 26.00, close: 25.375},
{date: new Date(1994,2,14), low: 25.125, high: 26.00, open: 25.625, close: 25.75},
{date: new Date(1994,2,15), low: 25.875, high: 26.625, open: 26.125, close: 26.375},
{date: new Date(1994,2,16), low: 26.25, high: 27.375, open: 26.25, close: 27.25},
{date: new Date(1994,2,17), low: 26.875, high: 27.25, open: 27.125, close: 26.875},
{date: new Date(1994,2,18), low: 26.375, high: 27.125, open: 27.00, close: 27.125},
{date: new Date(1994,2,21), low: 26.75, high: 27.875, open: 26.875, close: 27.75},
{date: new Date(1994,2,22), low: 26.75, high: 28.375, open: 27.50, close: 27.00},
{date: new Date(1994,2,23), low: 26.875, high: 28.125, open: 27.00, close: 28.00},
{date: new Date(1994,2,24), low: 26.25, high: 27.875, open: 27.75, close: 27.625},
{date: new Date(1994,2,25), low: 27.50, high: 28.75, open: 27.75, close: 28.00},
{date: new Date(1994,2,28), low: 25.75, high: 28.25, open: 28.00, close: 27.25},
{date: new Date(1994,2,29), low: 26.375, high: 27.50, open: 27.50, close: 26.875},
{date: new Date(1994,2,30), low: 25.75, high: 27.50, open: 26.375, close: 26.25},
{date: new Date(1994,2,31), low: 24.75, high: 27.00, open: 26.50, close: 25.25},
];
$(function () {
$("#chartContainer").dxChart({
dataSource: dataSource,
commonSeriesSettings: {
type: 'stock'
},
series: {},
argumentAxis: {
tickInterval: { days: 2 },
label: {
format: 'dd/MM'
}
}
});
});
查看:
加价:
<div id="chartContainer" style="height:500px; max-width:700px; margin: 0 auto"></div>
问题:
此处我的日期为new Date(1994,2,1)
,在图表中显示
02/03
在开始和结束的额外日期显示在图表中,如
28/2和30/3
那么,我应该更改什么才能使我的日期与数据源相同?
您也可以通过以下链接访问示例 DevExpress Link
答案 0 :(得分:1)
使用连续轴,您可以指定从最大值和最小值延伸轴的距离。使用轴&#39; minValueMargin和maxValueMargin属性可以执行此操作。
同时通过将valueMarginsEnabled属性设置为false来检查它。
默认情况下,轴稍微延伸超出极值。它阻止了 切断最小和最大系列点的部分。要禁用 此功能,将valueMarginsEnabled选项设置为false。
关于日期格式,请检查图表小工具理解的数据/时间样式。
答案 1 :(得分:1)
原因是JavaScript计算从0到11的月份。一月是0.十二月是11.这就是为什么会发生这种情况。请参阅JavaScript Dates了解详情。
答案 2 :(得分:0)
如果您的约会没有间隔,请尝试将argumentAxis.type
切换为discrete
。当轴为continuous
时,图表将处理原始数据并更改用于argumentAxis
的值。