highcharts中的最小、最大阈值
@海查特股票 我怎么能有两个门槛?对于图中的最小值,最大值 例如,这里只设置了一个阈值 或 除了highcharts中的threshold选项,还有什么方法可以在highcharts中的最小、最大阈值,highcharts,Highcharts,@海查特股票 我怎么能有两个门槛?对于图中的最小值,最大值 例如,这里只设置了一个阈值 或 除了highcharts中的threshold选项,还有什么方法可以在 它们不在最小:最大范围内?为什么不在包含正常范围的系列后面(或上面)渲染第二个波段。然后,您可以很容易地看到哪些点落在该范围之外。解决此问题的更好方法是在图表上添加两条绘图线,以指示 允许的最小值和最大值 假设您希望将其应用于yAxis,并将最小值设置为100,最大值设置为500,您可以这样: var min = 100; var
它们不在最小:最大范围内?为什么不在包含正常范围的系列后面(或上面)渲染第二个波段。然后,您可以很容易地看到哪些点落在该范围之外。解决此问题的更好方法是在图表上添加两条绘图线,以指示 允许的最小值和最大值 假设您希望将其应用于yAxis,并将最小值设置为100,最大值设置为500,您可以这样:
var min = 100;
var max = 500;
yAxis: {
min: min - 100,
max: max + 100,
plotLines: [{
id: 'limit-min',
color: '#FF0000',
dashStyle: 'ShortDash',
width: 2,
value: min,
zIndex: 0
}, {
id: 'limit-max',
color: '#FF0000',
dashStyle: 'ShortDash',
width: 2,
value: max,
zIndex: 0
}]
}
在最大值和最小值上加上或减去100的原因是我们希望绘图线在图表上可见
希望能有所帮助。根据答案,我创建了一个快速代码示例。我认为如果你有最小值的红线,你可以清楚地看到哪些点低于你允许的最小值 完整代码:
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>How to add min and max thresholds in Highcharts</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript">
$(function () {
var chart;
$(document).ready(function() {
chart = new Highcharts.Chart({
chart: {
renderTo: 'container',
type: 'line',
marginRight: 130,
marginBottom: 25
},
title: {
text: 'Sales By Month',
},
subtitle: {
text: 'Metrics',
},
xAxis: {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
},
yAxis: {
title: {
text: 'Revenue'
},
plotLines: [{
id: 'limit-min',
color: '#FF0000',
dashStyle: 'ShortDash',
width: 2,
value: 22000,
zIndex: 0,
label : {
text : 'Last Year\'s Minimum Revenue'
}
}, {
id: 'limit-max',
color: '#008000',
dashStyle: 'ShortDash',
width: 2,
value: 32000,
zIndex: 0,
label : {
text : 'Last Year\'s Maximum Revenue'
}
}]
},
tooltip: {
formatter: function() {
return '<b>'+ this.series.name +'</b><br/>'+
this.x +': $'+ this.y;
}
},
legend: {
layout: 'vertical',
align: 'right',
verticalAlign: 'top',
x: -10,
y: 100,
borderWidth: 0
},
series: [{
name: 'Revenue',
data: [21000, 24000, 27500, 33000, 29000, 26000, 19000, 21000, 25000, 29000, 23000, 18000]
}]
});
});
});
</script>
</head>
<body>
<script src="js/highcharts.js"></script>
<script src="js/modules/exporting.js"></script>
<div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div>
</body>
</html>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>How to add min and max thresholds in Highcharts</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript">
$(function () {
var chart;
$(document).ready(function() {
chart = new Highcharts.Chart({
chart: {
renderTo: 'container',
type: 'line',
marginRight: 130,
marginBottom: 25
},
title: {
text: 'Sales By Month',
},
subtitle: {
text: 'Metrics',
},
xAxis: {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
},
yAxis: {
title: {
text: 'Revenue'
},
plotLines: [{
color: '#FF0000',
dashStyle: 'ShortDash',
width: 2,
value: 22,
zIndex: 0,
label : {
text : 'Goal'
}
}, {
color: '#008000',
dashStyle: 'ShortDash',
width: 2,
value: 10,
zIndex: 0,
label : {
text : 'Loss'
}
}]
},
tooltip: {
formatter: function() {
return '<b>'+ this.series.name +'</b><br/>'+
this.x +': $'+ this.y;
}
},
legend: {
layout: 'vertical',
align: 'right',
verticalAlign: 'top',
x: -10,
y: 100,
borderWidth: 0
},
series: [{
name: 'Revenue',
data: [21000, 24000, 27500, 33000, 29000, 26000, 19000, 21000, 25000, 29000, 23000, 18000]
}]
});
});
});
</script>
</head>
<body>
<script src="js/highcharts.js"></script>
<script src="js/modules/exporting.js"></script>
<div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div>
</body>
</html>
如何在Highcharts中添加最小和最大阈值
$(函数(){
var图;
$(文档).ready(函数(){
图表=新的高点图表。图表({
图表:{
renderTo:'容器',
键入:“行”,
marginRight:130,
marginBottom:25
},
标题:{
文字:“按月销售”,
},
副标题:{
文本:“度量”,
},
xAxis:{
类别:[‘一月’、‘二月’、‘三月’、‘四月’、‘五月’、‘六月’,
‘七月’、‘八月’、‘九月’、‘十月’、‘十一月’、‘十二月’]
},
亚克斯:{
标题:{
文本:“收入”
},
绘图线:[{
id:'限制最小值',
颜色:“#FF0000”,
短跑风格:“短跑”,
宽度:2,
价值:22000,
zIndex:0,
标签:{
文字:“去年的最低收入”
}
}, {
id:“限制最大值”,
颜色:“#008000”,
短跑风格:“短跑”,
宽度:2,
价值:32000,
zIndex:0,
标签:{
文字:“去年的最大收入”
}
}]
},
工具提示:{
格式化程序:函数(){
返回“+this.series.name+”
+
this.x+':$'+this.y;
}
},
图例:{
布局:“垂直”,
对齐:“右”,
垂直排列:“顶部”,
x:-10,
y:100,
边框宽度:0
},
系列:[{
名称:'收入',
数据:[2100024000275003300029002600019002100002500029000230018000]
}]
});
});
});
正在进行演示。根据答案,我创建了一个快速代码示例。我认为如果你有最小值的红线,你可以清楚地看到哪些点低于你允许的最小值 完整代码:
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>How to add min and max thresholds in Highcharts</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript">
$(function () {
var chart;
$(document).ready(function() {
chart = new Highcharts.Chart({
chart: {
renderTo: 'container',
type: 'line',
marginRight: 130,
marginBottom: 25
},
title: {
text: 'Sales By Month',
},
subtitle: {
text: 'Metrics',
},
xAxis: {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
},
yAxis: {
title: {
text: 'Revenue'
},
plotLines: [{
id: 'limit-min',
color: '#FF0000',
dashStyle: 'ShortDash',
width: 2,
value: 22000,
zIndex: 0,
label : {
text : 'Last Year\'s Minimum Revenue'
}
}, {
id: 'limit-max',
color: '#008000',
dashStyle: 'ShortDash',
width: 2,
value: 32000,
zIndex: 0,
label : {
text : 'Last Year\'s Maximum Revenue'
}
}]
},
tooltip: {
formatter: function() {
return '<b>'+ this.series.name +'</b><br/>'+
this.x +': $'+ this.y;
}
},
legend: {
layout: 'vertical',
align: 'right',
verticalAlign: 'top',
x: -10,
y: 100,
borderWidth: 0
},
series: [{
name: 'Revenue',
data: [21000, 24000, 27500, 33000, 29000, 26000, 19000, 21000, 25000, 29000, 23000, 18000]
}]
});
});
});
</script>
</head>
<body>
<script src="js/highcharts.js"></script>
<script src="js/modules/exporting.js"></script>
<div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div>
</body>
</html>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>How to add min and max thresholds in Highcharts</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript">
$(function () {
var chart;
$(document).ready(function() {
chart = new Highcharts.Chart({
chart: {
renderTo: 'container',
type: 'line',
marginRight: 130,
marginBottom: 25
},
title: {
text: 'Sales By Month',
},
subtitle: {
text: 'Metrics',
},
xAxis: {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
},
yAxis: {
title: {
text: 'Revenue'
},
plotLines: [{
color: '#FF0000',
dashStyle: 'ShortDash',
width: 2,
value: 22,
zIndex: 0,
label : {
text : 'Goal'
}
}, {
color: '#008000',
dashStyle: 'ShortDash',
width: 2,
value: 10,
zIndex: 0,
label : {
text : 'Loss'
}
}]
},
tooltip: {
formatter: function() {
return '<b>'+ this.series.name +'</b><br/>'+
this.x +': $'+ this.y;
}
},
legend: {
layout: 'vertical',
align: 'right',
verticalAlign: 'top',
x: -10,
y: 100,
borderWidth: 0
},
series: [{
name: 'Revenue',
data: [21000, 24000, 27500, 33000, 29000, 26000, 19000, 21000, 25000, 29000, 23000, 18000]
}]
});
});
});
</script>
</head>
<body>
<script src="js/highcharts.js"></script>
<script src="js/modules/exporting.js"></script>
<div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div>
</body>
</html>
如何在Highcharts中添加最小和最大阈值
$(函数(){
var图;
$(文档).ready(函数(){
图表=新的高点图表。图表({
图表:{
renderTo:'容器',
键入:“行”,
marginRight:130,
marginBottom:25
},
标题:{
文字:“按月销售”,
},
副标题:{
文本:“度量”,
},
xAxis:{
类别:[‘一月’、‘二月’、‘三月’、‘四月’、‘五月’、‘六月’,
‘七月’、‘八月’、‘九月’、‘十月’、‘十一月’、‘十二月’]
},
亚克斯:{
标题:{
文本:“收入”
},
绘图线:[{
颜色:“#FF0000”,
短跑风格:“短跑”,
宽度:2,
价值:22,
zIndex:0,
标签:{
文本:“目标”
}
}, {
颜色:“#008000”,
短跑风格:“短跑”,
宽度:2,
数值:10,
zIndex:0,
标签:{
文字:“损失”
}
}]
},
工具提示:{
格式化程序:函数(){
返回“+this.series.name+”
+
this.x+':$'+this.y;
}
},
图例:{
布局:“垂直”,
对齐:“右”,
垂直排列:“顶部”,
x:-10,
y:100,
边框宽度:0
},
系列:[{
名称:'收入',
数据:[2100024000275003300029002600019002100002500029000230018000]
}]
});
});
});
编辑小提琴的工作演示。这可能会对您有所帮助。您需要在此处记录您的工作-基于链接的答案通常是不可接受的。仅链接的答案直接指向您的网站。这不是对社区的宝贵贡献。