[英]Highchart logarithmic X axis fail without zero values nor threshold under zero nor minimum
I have a problem with logarithmic X-axis. 我有一个对数X轴问题。 Have a threshold above 0, minimum of x is 1 and all X values are above 0. And still giving me the same error Can't plot zero or subzero values on a logarithmic axis
阈值大于0,x的最小值为1,所有X值均大于0。并且仍然给我相同的错误无法在对数轴上绘制零或零以下的值
Here is a fiddle with the problem (and the code) http://jsfiddle.net/y31gwofL/3/ 这是一个有关问题(和代码)的小提琴, http://jsfiddle.net/y31gwofL/3/
$(function () {
$('#container').highcharts({
chart: {
type: 'line'
},
xAxis: {
type: "logarithmic",
min: 1
},
yAxis: {
type: "linear"
},
series: [
{
type: "line",
data: [
{
"name": 1,
"y": 9.991242714224013
},
{
"name": 2,
"y": 9.991242714224013
},
{
"name": 3,
"y": 9.991242714224011
},
{
"name": 4,
"y": 9.991242714224015
},
{
"name": 5,
"y": 9.991242714224015
},
{
"name": 6,
"y": 9.991242714224008
},
{
"name": 7,
"y": 9.991242714224015
},
{
"name": 8,
"y": 9.991242714224015
}
]
}
]
});
});
This is happening because you are telling it to take the log of "1" or "2" or "3", etc. You are defining your xAxis as a series of categories instead of integers. 发生这种情况的原因是,您告诉它接受对数“ 1”或“ 2”或“ 3”等。您将xAxis定义为一系列类别而不是整数。 Make your series data like:
使您的系列数据如下:
$(function () {
$('#container').highcharts({
chart: {
type: 'line'
},
xAxis: {
type: "logarithmic",
min: 1
},
yAxis: {
type: "linear"
},
series: [
{
type: "line",
data: [
{
"x": 1,
"y": 9.991242714224013
},
{
"x": 2,
"y": 9.991242714224013
},
{
"x": 3,
"y": 9.991242714224011
},
{
"x": 4,
"y": 9.991242714224015
},
{
"x": 5,
"y": 9.991242714224015
},
{
"x": 6,
"y": 9.991242714224008
},
{
"x": 7,
"y": 9.991242714224015
},
{
"x": 8,
"y": 9.991242714224015
}
]
}
]
});
});
Note I have replaced "name"
with "x"
. 注意我已经用
"x"
代替了"name"
"x"
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.