score:0
Set fill:
value false
let chart = new Chart('myChart', {
type: 'line',
data: {
labels: ['Red', 'Blue', 'Yellow', 'Green', 'Purple', 'Orange'],
datasets: [{
label: '# of Votes',
data: [12, 19, 3, 5, 2, 3],
fill: false, // <-- Here
}]
},
options: {
responsive: true,
maintainAspectRatio: false,
scales: {
y: {
beginAtZero: true
}
}
}
});
<script src="https://cdn.jsdelivr.net/npm/chart.js@3.6.2/dist/chart.min.js"></script>
<canvas id="myChart" width="400" height="400"></canvas>
score:1
just tweak ts file to include ::
chartOptions = {
scales: { xAxes: [{}], yAxes: [{}] },
elements: { line: { fill: false } }
};
html file looking as ::
<div style="display: block; width: 500px; height: 400px;">
<canvas
baseChart
[chartType]="'line'"
[datasets]="chartData"
[labels]="chartLabels"
[colors]="lineChartColors"
[options]="chartOptions"
[legend]="true"
(chartClick)="onChartClick($event)">
</canvas>
</div>
This will Work
score:2
I had the same issue, using angular-chart.js and got the desired result with:
$scope.override = {
fill: false
};
and
<canvas class="chart chart-line"
chart-dataset-override="override"
chart-data="data">
</canvas>
score:6
This worked for me:
$scope.color = [{
backgroundColor: 'transparent',
borderColor: '#F78511',
},];
score:6
I solved this issue.
First step. html element inner add <- chart-colors="colors" like this :
<canvas id="line" class="chart chart-line" data="data" labels="labels" chart-colors="colors" legend="true" series="series" options="options" click="onClick"></canvas>
second step. $scope val colors Add like this :
$scope.colors = [{
backgroundColor : '#0062ff',
pointBackgroundColor: '#0062ff',
pointHoverBackgroundColor: '#0062ff',
borderColor: '#0062ff',
pointBorderColor: '#0062ff',
pointHoverBorderColor: '#0062ff',
fill: false /* this option hide background-color */
}, '#00ADF9', '#FDB45C', '#46BFBD'];
good luck!
score:11
Just set the fill option to be false in the datasets options:
data: {
datasets: [{
label: "",
data: dataPoints,
borderColor: color ,
fill:false //this for not fill the color underneath the line
}]
},
score:34
Below solution was working when integrated chart js with Angular
$scope.options = {
scales: {
yAxes: [
{
id: 'y-axis-1',
type: 'linear',
display: true,
position: 'left'
}
]
},
elements: {
line: {
fill: false
}
}
};
<canvas id="" class="col-sm-12 chart chart-line" chart-data="data"
chart-options="options" chart-colors="colors">
</canvas>
score:121
Check this section on the Chart.js docs. Set the fill
property to false within your dataset configuration:
var data = {
labels: ["January", "February", "March", "April", "May", "June", "July"],
datasets: [{
label: "My First dataset",
fill: false,
data: [1, 2, 3]
}]
};
Specify an array to the borderColor
property if you want each line to have a different stroke color:
var myColors = ['red', 'green', 'blue']; // Define your colors
var data = {
labels: ["January", "February", "March", "April", "May", "June", "July"],
datasets: [{
label: "My First dataset",
fill: false,
borderColor: myColors
data: [1, 2, 3]
}]
};
Source: stackoverflow.com
Related Query
- ChartJS Line Charts - remove color underneath lines
- Remove background color in chartjs line chart
- Chartjs change grid line color
- Chart.js - Line charts with different colors for each border lines
- Chartjs Line Color Between Two Points
- Different color for line segments in ChartJS
- How do I make line charts overlay over bar charts in chartjs
- How to add background color between two lines in yAxis Chartjs
- How to add multiple background color in line charts
- Setting Common labels and background color common for all the charts in ChartJs
- How to add background color between two specific lines in Chartjs 3.1
- Generate multiple line charts in Django with ChartJS
- How to make lines in line charts from ng2-charts straight lines?
- ChartJS Version 3 - common legend for multiple line charts
- how can i remove the grid lines in chartJs
- Line Charts color all greyed out (ng2-charts)
- chartjs line graph points with different color
- Remove excess lines on y axis using chartjs
- ChartJS remove vertical grid lines one on two
- ChartJS color specific Grid Lines
- My ChartJS Line needs to click the color legend first before it plots the data
- Trouble with setting background color for Line chart at Chartjs version 3.5.1
- How to remove Grid lines except for zero line and border Chartjs?
- Combine two line charts into one in ChartJS
- ChartJS incorrect plot when plotting multiple line charts in one graph
- How to extend chartjs line charts in ReactJS to show solid and dashed line together?
- How can I change the color of certain lines in chartjs / vue-chartjs?
- ChartJS v2: how to remove strange line in Line Chart
- How do I use ChartJS with a background color in the space between two line charts?
- Remove y and x axis lines and change axis font style in Chartjs
More Query from same tag
- Javascript : ""Uncaught TypeError: Cannot read property 'x' of undefined"" in canvasjs.min.js
- Trying to refresh label when click on it. Cannot read property '_meta' of undefined"
- How to apply gradient color in chart.js?
- Chart.js V2. bar chart with a fixed y-axis
- Parsing JSON data into specific format for chart.js
- math.max() doesn't work in IE
- custom ticks in ChartsJS line plot
- Angular how to display data inside every part of doughnut chartjs
- How can i change tick val to title in ChartJS
- bootstrap ui+angular chart: is it possible to disable graph's auto refreshing?
- Set custom colours for tooltip squares Chart.js
- Display character after y-axis data value in onhover pop up Chart.js
- React-chartjs-2 - Each dataset needs a unique key
- Chart.js Show Dollar Amount On Left Y And Percent Amount On Right Y
- Using data saved as a variable in HTML from Python
- chart.js 3 stacked bar chart - tooltip showing for zero values
- Grouped Bar Chart from mySQL database using ChartJS and PHP
- How to add new x axis in chart JS?
- Chartjs: How can I group datasets closer if I have maxBarThickness set?
- How do I use the return values from csv ajax request for x and y values?
- how do i make ungrouped datasets with charts.js
- Change the hover data value from to string
- How to display a progress over time in one horizontally stacked bar with chartjs
- Chart js not working properly in Safari
- Charts.js polar area scales
- Chart.js graph with just two cordinates
- Remove specific label
- chart.js 2.7.1 | Updating charts with variables
- destroy method implementation in pie chart chartjs
- Chart.js in a Vue page throws error: do not mutate vuex store state outside mutation handlers