- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我已经为我在一页上使用的相同类型的 highcharts 设置了 highchart 选项。一切工作正常,但一件事是,它不会渲染图表的绘图线。我不确定我的设置是否正确。你可以看看我做了什么here 。下面是我的脚本:
$(function () {
Highcharts.setOptions({
chart: {
type: 'boxplot'
},
title: {
useHTML: true,
},
legend: {
enabled: false
},
xAxis: {
categories: ['2011', '2012', '2013', '2014', '2015'],
title: {
text: 'Experiment No.'
}
},
yAxis: {
plotLines: [{
color: 'red',
width: 1,
label: {
align: 'center',
style: {
color: 'gray'
}
}
}]
},
series: [{
color: Highcharts.getOptions().colors[0],
type: 'scatter',
marker: {
fillColor: 'white',
lineWidth: 1,
lineColor: Highcharts.getOptions().colors[0]
}
}]
});
var chart1 = new Highcharts.Chart({
chart: {
renderTo: 'indikator1',
},
title: {
text: '<i class="ion-help"></i> Arbeidsmarkedsintegrasjon'
},
yAxis: {
title: {
text: 'Verdi'
},
plotLines: [{
value: 932,
label: {
text: 'Theoretical mean: 932',
}
}]
},
series: [{
name: 'Observations',
data: [
[760, 801, 848, 895, 965],
[733, 853, 939, 980, 1080],
[714, 762, 817, 870, 918],
[724, 802, 806, 871, 950],
[834, 836, 864, 882, 910]
],
tooltip: {
headerFormat: '<em>Experiment No {point.key}</em><br/>'
}
},
{
name: 'Outlier',
data: [ // x, y positions where 0 is the first category
[0, 644],
[4, 718],
[4, 951],
[4, 969]
],
tooltip: {
pointFormat: 'Observation: {point.y}'
}
}]
});
var chart2 = new Highcharts.Chart({
chart: {
renderTo: 'indikator2',
},
title: {
text: '<i class="ion-help"></i> Arbeidsmarkedsintegrasjon'
},
yAxis: {
title: {
text: 'Verdi'
},
plotLines: [{
value: 932,
label: {
text: 'Theoretical mean: 932',
}
}]
},
series: [{
name: 'Observations',
data: [
[760, 801, 848, 895, 965],
[733, 853, 939, 980, 1080],
[714, 762, 817, 870, 918],
[724, 802, 806, 871, 950],
[834, 836, 864, 882, 910]
],
tooltip: {
headerFormat: '<em>Experiment No {point.key}</em><br/>'
}
},
{
name: 'Outlier',
data: [ // x, y positions where 0 is the first category
[0, 644],
[4, 718],
[4, 951],
[4, 969]
],
tooltip: {
pointFormat: 'Observation: {point.y}'
}
}]
});
var chart3 = new Highcharts.Chart({
chart: {
renderTo: 'indikator3',
},
title: {
text: '<i class="ion-help"></i> Arbeidsmarkedsintegrasjon'
},
yAxis: {
title: {
text: 'Verdi'
},
plotLines: [{
value: 932,
label: {
text: 'Theoretical mean: 932',
}
}]
},
series: [{
name: 'Observations',
data: [
[760, 801, 848, 895, 965],
[733, 853, 939, 980, 1080],
[714, 762, 817, 870, 918],
[724, 802, 806, 871, 950],
[834, 836, 864, 882, 910]
],
tooltip: {
headerFormat: '<em>Experiment No {point.key}</em><br/>'
}
},
{
name: 'Outlier',
data: [ // x, y positions where 0 is the first category
[0, 644],
[4, 718],
[4, 951],
[4, 969]
],
tooltip: {
pointFormat: 'Observation: {point.y}'
}
}]
});
var chart4 = new Highcharts.Chart({
chart: {
renderTo: 'indikator4',
},
title: {
text: '<i class="ion-help"></i> Arbeidsmarkedsintegrasjon'
},
yAxis: {
title: {
text: 'Verdi'
},
plotLines: [{
value: 932,
label: {
text: 'Theoretical mean: 932',
}
}]
},
series: [{
name: 'Observations',
data: [
[760, 801, 848, 895, 965],
[733, 853, 939, 980, 1080],
[714, 762, 817, 870, 918],
[724, 802, 806, 871, 950],
[834, 836, 864, 882, 910]
],
tooltip: {
headerFormat: '<em>Experiment No {point.key}</em><br/>'
}
},
{
name: 'Outlier',
data: [ // x, y positions where 0 is the first category
[0, 644],
[4, 718],
[4, 951],
[4, 969]
],
tooltip: {
pointFormat: 'Observation: {point.y}'
}
}]
});
var chart5 = new Highcharts.Chart({
chart: {
renderTo: 'indikator5',
},
title: {
text: '<i class="ion-help"></i> Arbeidsmarkedsintegrasjon'
},
yAxis: {
title: {
text: 'Verdi'
},
plotLines: [{
value: 932,
label: {
text: 'Theoretical mean: 932',
}
}]
},
series: [{
name: 'Observations',
data: [
[760, 801, 848, 895, 965],
[733, 853, 939, 980, 1080],
[714, 762, 817, 870, 918],
[724, 802, 806, 871, 950],
[834, 836, 864, 882, 910]
],
tooltip: {
headerFormat: '<em>Experiment No {point.key}</em><br/>'
}
},
{
name: 'Outlier',
data: [ // x, y positions where 0 is the first category
[0, 644],
[4, 718],
[4, 951],
[4, 969]
],
tooltip: {
pointFormat: 'Observation: {point.y}'
}
}]
});
var chart6 = new Highcharts.Chart({
chart: {
renderTo: 'indikator6',
},
title: {
text: '<i class="ion-help"></i> Arbeidsmarkedsintegrasjon'
},
yAxis: {
title: {
text: 'Verdi'
},
plotLines: [{
value: 932,
label: {
text: 'Theoretical mean: 932',
}
}]
},
series: [{
name: 'Observations',
data: [
[760, 801, 848, 895, 965],
[733, 853, 939, 980, 1080],
[714, 762, 817, 870, 918],
[724, 802, 806, 871, 950],
[834, 836, 864, 882, 910]
],
tooltip: {
headerFormat: '<em>Experiment No {point.key}</em><br/>'
}
},
{
name: 'Outlier',
data: [ // x, y positions where 0 is the first category
[0, 644],
[4, 718],
[4, 951],
[4, 969]
],
tooltip: {
pointFormat: 'Observation: {point.y}'
}
}]
});
var chart7 = new Highcharts.Chart({
chart: {
renderTo: 'indikator7',
},
title: {
text: '<i class="ion-help"></i> Arbeidsmarkedsintegrasjon'
},
yAxis: {
title: {
text: 'Verdi'
},
plotLines: [{
value: 932,
label: {
text: 'Theoretical mean: 932',
}
}]
},
series: [{
name: 'Observations',
data: [
[760, 801, 848, 895, 965],
[733, 853, 939, 980, 1080],
[714, 762, 817, 870, 918],
[724, 802, 806, 871, 950],
[834, 836, 864, 882, 910]
],
tooltip: {
headerFormat: '<em>Experiment No {point.key}</em><br/>'
}
},
{
name: 'Outlier',
data: [ // x, y positions where 0 is the first category
[0, 644],
[4, 718],
[4, 951],
[4, 969]
],
tooltip: {
pointFormat: 'Observation: {point.y}'
}
}]
});
var chart8 = new Highcharts.Chart({
chart: {
renderTo: 'indikator8',
},
title: {
text: '<i class="ion-help"></i> Arbeidsmarkedsintegrasjon'
},
yAxis: {
title: {
text: 'Verdi'
},
plotLines: [{
value: 932,
label: {
text: 'Theoretical mean: 932',
}
}]
},
series: [{
name: 'Observations',
data: [
[760, 801, 848, 895, 965],
[733, 853, 939, 980, 1080],
[714, 762, 817, 870, 918],
[724, 802, 806, 871, 950],
[834, 836, 864, 882, 910]
],
tooltip: {
headerFormat: '<em>Experiment No {point.key}</em><br/>'
}
},
{
name: 'Outlier',
data: [ // x, y positions where 0 is the first category
[0, 644],
[4, 718],
[4, 951],
[4, 969]
],
tooltip: {
pointFormat: 'Observation: {point.y}'
}
}]
});
var chart9 = new Highcharts.Chart({
chart: {
renderTo: 'indikator9',
},
title: {
text: '<i class="ion-help"></i> Arbeidsmarkedsintegrasjon'
},
yAxis: {
title: {
text: 'Verdi'
},
plotLines: [{
value: 932,
label: {
text: 'Theoretical mean: 932',
}
}]
},
series: [{
name: 'Observations',
data: [
[760, 801, 848, 895, 965],
[733, 853, 939, 980, 1080],
[714, 762, 817, 870, 918],
[724, 802, 806, 871, 950],
[834, 836, 864, 882, 910]
],
tooltip: {
headerFormat: '<em>Experiment No {point.key}</em><br/>'
}
},
{
name: 'Outlier',
data: [ // x, y positions where 0 is the first category
[0, 644],
[4, 718],
[4, 951],
[4, 969]
],
tooltip: {
pointFormat: 'Observation: {point.y}'
}
}]
});
var chart10 = new Highcharts.Chart({
chart: {
renderTo: 'indikator10',
},
title: {
text: '<i class="ion-help"></i> Arbeidsmarkedsintegrasjon'
},
yAxis: {
title: {
text: 'Verdi'
},
plotLines: [{
value: 932,
label: {
text: 'Theoretical mean: 932',
}
}]
},
series: [{
name: 'Observations',
data: [
[760, 801, 848, 895, 965],
[733, 853, 939, 980, 1080],
[714, 762, 817, 870, 918],
[724, 802, 806, 871, 950],
[834, 836, 864, 882, 910]
],
tooltip: {
headerFormat: '<em>Experiment No {point.key}</em><br/>'
}
},
{
name: 'Outlier',
data: [ // x, y positions where 0 is the first category
[0, 644],
[4, 718],
[4, 951],
[4, 969]
],
tooltip: {
pointFormat: 'Observation: {point.y}'
}
}]
});
var chart11 = new Highcharts.Chart({
chart: {
renderTo: 'indikator11',
},
title: {
text: '<i class="ion-help"></i> Arbeidsmarkedsintegrasjon'
},
yAxis: {
title: {
text: 'Verdi'
},
plotLines: [{
value: 932,
label: {
text: 'Theoretical mean: 932',
}
}]
},
series: [{
name: 'Observations',
data: [
[760, 801, 848, 895, 965],
[733, 853, 939, 980, 1080],
[714, 762, 817, 870, 918],
[724, 802, 806, 871, 950],
[834, 836, 864, 882, 910]
],
tooltip: {
headerFormat: '<em>Experiment No {point.key}</em><br/>'
}
},
{
name: 'Outlier',
data: [ // x, y positions where 0 is the first category
[0, 644],
[4, 718],
[4, 951],
[4, 969]
],
tooltip: {
pointFormat: 'Observation: {point.y}'
}
}]
});
});
最佳答案
您需要在图表中单独设置选项。全局选项不会被每个图表的设置覆盖 - 但在您的个人图表中,您没有设置颜色
或线条的宽度
。从全局选项部分中删除 plotLines
并仅在每个图表的部分中执行此操作。
要处理对象属性的合并,您可以使用此 question 。这是一个粗略且现成的示例:
function merge_options(obj1,obj2){
var obj3 = {};
for (var attrname in obj1) { obj3[attrname] = obj1[attrname]; }
for (var attrname in obj2) { obj3[attrname] = obj2[attrname]; }
return obj3;
}
var plotLinesOption = {
width: 1,
color: 'red'
};
Highcharts.setOptions({
chart: {
type: 'boxplot'
},
title: {
useHTML: true,
},
legend: {
enabled: false
},
xAxis: {
categories: ['2011', '2012', '2013', '2014', '2015'],
title: {
text: 'Experiment No.'
}
},
series: [{
color: Highcharts.getOptions().colors[0],
type: 'scatter',
marker: {
fillColor: 'white',
lineWidth: 1,
lineColor: Highcharts.getOptions().colors[0]
}
}]
});
var chart1 = new Highcharts.Chart({
chart: {
renderTo: 'indikator1',
},
title: {
text: '<i class="ion-help"></i> Arbeidsmarkedsintegrasjon'
},
yAxis: {
title: {
text: 'Verdi'
},
plotLines: [merge_options(plotLinesOption,{value: 932, label:{text: 'Theoretical mean: 932'}})]
},
series: [{
name: 'Observations',
data: [
[760, 801, 848, 895, 965],
[733, 853, 939, 980, 1080],
[714, 762, 817, 870, 918],
[724, 802, 806, 871, 950],
[834, 836, 864, 882, 910]
],
tooltip: {
headerFormat: '<em>Experiment No {point.key}</em><br/>'
}
},
{
name: 'Outlier',
data: [ // x, y positions where 0 is the first category
[0, 644],
[4, 718],
[4, 951],
[4, 969]
],
tooltip: {
pointFormat: 'Observation: {point.y}'
}
}]
});
还有现场demo 。请注意,我只更新了 chart1
。
这里是version使用 Highcharts.merge() 函数而不是外部函数。
关于javascript - Highcharts -plotLines 不会渲染,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37321578/
绘制时间序列时,在 highcharter 库的 plotLines 和 plotBands 中指定值的正确方法是什么?使用以下代码,绘图线出现在图表的左端,而带根本不出现。如果我不指定 type =
我已经为我在一页上使用的相同类型的 highcharts 设置了 highchart 选项。一切工作正常,但一件事是,它不会渲染图表的绘图线。我不确定我的设置是否正确。你可以看看我做了什么here 。
我有一个包含列和线的图表。我使用绘图线为折线图添加了一条平均线。 我的问题是线条的数据标签与绘图文本重叠。我在这里重现了这个错误(见最后的数据标签)。 : http://jsfiddle.net/cs
我有一个包含一系列的散点图。一些观察结果具有相应的极限值,我已将其添加为 PlotLines。假设有 2 个独特的 PlotLines,每个散点观察仅属于其中一个。更复杂的是,有多个散点系列,因此这必
我正在尝试在 Highcharts 上渲染 plotLines。但不知何故,我无法在 plotLines 上呈现标签。 这是代码片段: var chart = new Highcharts.Chart
我有一个带有水平 PlotLine 的散点图。我希望人们能够拖动情节线。 y 轴值用作生成柱形图的阈值(柱形图最初是使用阈值的默认值生成的)。到目前为止,我已经使用在 Highcharts 论坛上找到
有什么方法可以让plotline随着动画移动到新的位置吗? 还是我必须使用其他插件? 我想构建像二进制选项或专家选项游戏一样的乐趣。 这是我的简单演示: Sample demo link $(func
我正在尝试在 highcharteR 中绘制一个每日值系列,在图表中标记一条垂直线 (plotline) 和一段日期 (plotband)。我研究了几个 SO 问题并找到了这个脚本,但我发现了以下问题
我正在创建一个带有 plotLine 的 HighChart。 plotLine 具有固定值,而图表之间的数据可能会有所不同。 HighChart 根据数据的最大值自动缩放 y 轴,但它在计算中不考虑
我遇到了重新定位 yAxis.plotLines.label 位置的问题。 我想将标签从原始位置移动到 plotLine 下。 请检查此 link Highcharts.chart('containe
我想在 highchart 中实现一个 x 轴 plotLines 动画。当我点击播放按钮时,每隔一秒就会生成一条新的情节线来替换 x 轴上的最后一条情节线。 请看这个fiddle .当我点击 cli
我用 Highcharts 创建了一个图表,绘制了两条 plotLines,一条是垂直的,一条是水平的。我已将它们的 zIndex 分别设置为 1001 和 1002,以确保可以在我的列系列上方看到这
http://jsfiddle.net/leongaban/n36y336z/ 我的 highChart 上有一个情节系列,它有一个标签。我想要做的是隐藏标签直到鼠标悬停。以前有人尝试过吗? $(fu
我正在使用 PlotLines 来处理 Highcharts。我想在 PlotLine 标签内添加一个链接来执行某些操作(例如删除或更新)。 $(function () { $
我使用 highchart 在 x 轴上的绘图线旁边显示一些文本。我想通过格式化程序函数自定义每个标签,因为图表中的所有其他标签都可以这样做。 我见过another topic on this mat
您好,我知道我可以像这样通过在 xAxis 上定义日期时间来添加情节线 xAxis: { plotLines: [{ color: '#dadada',
当我尝试在柱形图上绘制两条 yAxis.plotLines 时出现重叠问题。plotLines 的标签已被列覆盖/重叠。 请看下面的截图 $(function () { $('#container')
我正在尝试让我的用户能够向图表添加最大 plotLine 并让它在图表超过该线时更改图表的背景颜色。我似乎无法获得更新情节的方法。我试过: chart.yAxis[0].update({ pl
我正在使用 Highchart 的 Char Bar,我想知道是否有办法显示平均线(绘图线)的值,在“yAxis”或鼠标悬停显示中显示值一个对话框,其中包含 Plot Line 的确切值。 我已经显示
嗨,我尝试了多种方法将文本框添加到“plotLines”。但我不知道该怎么做,所以我提出疑问。 情节线的时间继续在一分钟内移动。我想将情节线的当前时间文本包装到一个白框中。 详情请引用jsfiddle
我是一名优秀的程序员,十分优秀!