@import 'https://code.highcharts.com/css/highcharts.css';
.highcharts-plot-background {
fill: #efffff;
}
.highcharts-plot-border {
stroke-width: 2px;
stroke: #7cb5ec;
}
我正在使用highcharts-vue在Vue应用程序中使用Highcharts
我正在这样设置模板
<highcharts class="vessChart" ref="chart" style="width:100%" :callback="chartcallback" :options="options" ></highcharts>
然后我在Vue中设置图表的选项
yAxis:[],
series:[],
background:[],
options: {
chart: {
borderWidth: 1,
marginLeft: 40,
marginRight: 2,
type:'line',
zoomType: 'x',
title: {
text: ''
},
panning:true
/*backgroundColor:'lightgrey'*/
},
title: {
text: ''
},
pane:{
background:[]
},
time:{
useUTC:true
},
credits:{
enabled:false
},
tooltip: {
shared: true
},
title:{
text:null
},
rangeSelector: {
inputEnabled: false
},
xAxis:{
type:'datetime',
title:
{
align:'high'
},
labels: {
padding: 50,
format: '{value:%e %b %Y}',
style: {
fontSize: '10px'
}
},
crosshair: {
enabled: true,
width: 2,
color: '#000'
},
},
yAxis: [],
plotOptions: {
series: {
animation: false
}
},
,series: []
}
然后,当我有要添加的数据时,我将数据分别推送到yAxis,系列和背景数组
this.data.titles.forEach(title => {
this.yAxis.push(
{
title: {
text: title.title,
margin:20,
fontSize:"15px"
},
labels: {
enabled:true,
align: 'left',
padding:15
},
alignTicks:'left',
textAlign:'left',
align:'middle',
height: chartHeight+'%',
top:topStep+'%',
opposite:false,
offset:0
}
);
this.background.push({backgroundColor: "red"});
topStep = topStep + chartHeight + 5;
this.series.push({
yAxis:counter,
name:title.title,
data:[]
});
counter++;
});//foreach
this.options.yAxis = this.yAxis;
this.options.series = this.series;
this.options.pane = this.background;
我尝试通过执行更多操作来导入highcharts->
来导入它import highchartsmore from './highcharts-more.js'
但是它不起作用,页面变回白色。我还尝试通过转到Vue的index.html并添加
<script src="https://code.highcharts.com/highcharts-more.js"></script>
页面没有错误,但是窗格仍然没有颜色。
*如果这不可能,我是否可以至少以某种方式在窗格之间添加一条线?
谢谢
我正在通过使用highcharts-vue在Vue应用程序中使用Highcharts,我像这样设置模板[]