[英]How do I use ChartJS with a background color in the space between two line charts?
你知道hicgcharts吗
$(function () { $('#container').highcharts({ chart: { type: 'area' }, title: { text: 'Temp' }, xAxis: { categories: ['1pm', '2pm', '3pm', '4pm', '5pm'] }, credits: { enabled: false }, colors: [ '#910000', '#00FFFF'], series: [{ name: 'Max Temp', data: [5, 3, 4, 7, 2] }, { name: 'Min Temp', data: [2, 2, 3, 2, 1] }] }); });
<script src="https://code.jquery.com/jquery-3.1.0.min.js"></script> <script src="https://code.highcharts.com/highcharts.js"></script> <script src="https://code.highcharts.com/modules/exporting.js"></script> <div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
来自另一个答案,但更接近您想要的。 (仅中间颜色)。 因此,基本上, 在ChartJS中,您需要覆盖2个填充的折线图,并使底部的1个变为白色 。 (不幸的是,它覆盖了网格线)
$(function () { $('#container').highcharts({ chart: { type: 'area' }, title: { text: 'Temp' }, xAxis: { categories: ['1pm', '2pm', '3pm', '4pm', '5pm'] }, credits: { enabled: false }, colors: [ '#910000', '#FFFFFF'], series: [{ name: 'Max Temp', data: [5, 3, 4, 7, 2] }, { name: 'Min Temp', data: [2, 2, 3, 2, 1] }] }); });
.highcharts-series-1 path{fill-opacity:1!important}
<script src="https://code.jquery.com/jquery-3.1.0.min.js"></script> <script src="https://code.highcharts.com/highcharts.js"></script> <script src="https://code.highcharts.com/modules/exporting.js"></script> <div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.