[英]same scale on x y axis in highchart
I am trying to plot a trajectory using Javascript and highcharts, similarly to this minimal example: 我正在尝试使用Javascript和highcharts绘制轨迹,类似于此最小示例:
$(function () {
$('#container').highcharts({
chart: {
type: 'line'
},
title: {
text: 'PLOT'
},
xAxis: {
title: {
text: 'X'
},
},
yAxis: {
title: {
text: 'Y'
},
},
series: [{
name: 'Trajectory',
data: [[1,2],[5,0],[0,0],[3,4]]
}]
});
});
( http://jsfiddle.net/LLExL/3614/ ) ( http://jsfiddle.net/LLExL/3614/ )
Since the unit for the values on x and y is meters, I would like to scale equally both the axis, otherwise my trajectory will end up being highly distorted (if you're familiar with Matlab, I want to reach the same result as in the 'axis equal' option for the standard matlab 'plot' function: 由于x和y上的值的单位是米,因此我想在两个轴上均等地缩放,否则我的轨迹最终会高度失真(如果您熟悉Matlab,我希望达到与标准Matlab``绘图''功能的``轴相等''选项:
)
)
Do you have any ideas on how I can achieve the same result in highcharts? 您对如何在图表中获得相同的结果有任何想法吗? Thank you !
谢谢 !
You can control width and height for x/yAxis setting width
/ height
options: http://jsfiddle.net/LLExL/3622/ 您可以控制x / yAxis设置
width
/ height
选项的width
和height
: http : //jsfiddle.net/LLExL/3622/
xAxis: {
height: 200,
width: 200,
title: {
text: 'X'
},
min: 0,
max: 6
},
yAxis: {
height: 200,
width: 200,
title: {
text: 'Y'
},
min: 0,
max: 6
},
I also added min
and max
to make sure both axes have the same scale. 我还添加了
min
和max
以确保两个轴具有相同的比例。
You can use tickInterval with min and max on X and Y Axis : http://jsfiddle.net/LLExL/3620/ 您可以将tickInterval与X和Y轴上的min和max一起使用: http : //jsfiddle.net/LLExL/3620/
xAxis: {
tickInterval: 2,
min: 0,
max: 6,
...
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.