javascript - ChartJS Line Charts - remove color underneath lines -
okay, have chartjs line chart working populates directly data coming db. need rid of color underneath each of lines. [as seen in screenshot below].
here's html:
<div ng-if="hasdata"> <canvas id="line" class="chart chart-line" data="data" labels="labels" legend="true" series="series" options="options" click="onclick"></canvas> <div>
here's js:
scope.labels = ['02:00','04:00','06:00', '08:00', '10:00', '12:00','14:00', '16:00', '18:00', '20:00', '22:00']; scope.series = series; scope.data = [volumesselecteddate, volumespeakdate, volumesmodelcapacity]; scope.options = { scaleoverride: true, scalestartvalue: 0, scalesteps: 11, scalestepwidth: 6910, } scope.loadingdailyappvolumes = false; scope.hasdata = true; }; scope.onclick = function (points, evt) { //console.log(points, evt); };
so, how go this? also, how go manually setting color each line?
example:
selected date: blue, peak date: yellow, model capacity: grey.
thanks.
check this section on chart.js docs. set fill
property false within dataset configuration:
var data = { labels: ["january", "february", "march", "april", "may", "june", "july"], datasets: [{ label: "my first dataset", fill: false, data: [1, 2, 3] }] };
specify array bordercolor
property if want each line have different stroke color:
var mycolors = ['red', 'green', 'blue']; // define colors var data = { labels: ["january", "february", "march", "april", "may", "june", "july"], datasets: [{ label: "my first dataset", fill: false, bordercolor: mycolors data: [1, 2, 3] }] };
Comments
Post a Comment