score:0
from your code i presume you're using an old version of chart.js.
new chart(ctx).line(data, {
...
charts are now created in a different way.
var mychart = new chart(ctx, {
type: 'line',
...
if you switch to version 2.9.3., it works fine as the following code sample illustrates.
new chart(document.getelementbyid('mychartaxis'), {
type: 'line',
data: {
labels: ['a', 'b', 'c', 'd'],
datasets: [
{
label: 'warnings',
data: [1, 2, 3, 2],
bordercolor: 'rgb(255, 159, 64)',
backgroundcolor: 'rgba(255, 159, 64, 0.2)'
},
{
label: 'errors',
data: [1, 2, 1, 3],
bordercolor: 'rgb(255, 99, 132)',
backgroundcolor: 'rgba(255, 99, 132, 0.2)'
}
]
},
options: {
scales: {
yaxes: [{
stacked: true
}]
}
}
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/chart.js/2.9.3/chart.bundle.min.js"></script>
<canvas id="mychartaxis" height="90"></canvas>
Source: stackoverflow.com
Related Query
- How to display stacked line chartjs
- ChartJS - how to display line chart with single element as a line? (not as a dot)
- Chartjs - how to make line position to vertical center and how to display dotted sharp in the backround?
- How to display a progress over time in one horizontally stacked bar with chartjs
- Display line chart with connected dots using chartJS
- Chartjs 2 - Stacked bar and unstacked line on same chart with same y axis
- How to display Line Chart dataset point labels with Chart.js?
- How to display value of only one datapoint in line chart
- How to display inline values in a stacked bar chart with Chart.js?
- How to render a vertical line on hover in chartjs
- ChartJs line chart - display permanent icon above some data points with text on hover
- How to display only one label in a multi line char?
- how to change Y axis value dynamically based on user input in Chartjs for Line chart?
- How to draw Horizontal line on Bar Chart Chartjs
- How to dynamically set ChartJs line chart width based on dataset size?
- How do I make line charts overlay over bar charts in chartjs
- How to add ChartJS code in Html2Pdf to view image
- How can I datalabels and Sum display in the same time on a stacked bar
- ChartJS (React) Line Chart - How to show single tooltip with data and labels from 3 (multiple) dataset?
- In Stacked horizontal bar chart how to remove the vertical line in Chart.js?
- How to create a stacked graph using ChartJS
- How to display data from top to bottom in stacked bar-chart QuickChart?
- How to make chartJs stacked bar always rounded when data is 0?
- How do I add time sourced from an external source as an X axis to a ChartJS graph?
- Adding line over stacked line chart with ChartJS
- ChartJS : How to display two "y axis" scales on a chart
- How to highlight a section of a stack in all bars in a stacked barchart in chartjs
- How to draw multiple line on y axis for same x axis in chartjs v2?
- how to display chart data as html table chartjs
- How to cut line graph in ChartJS
More Query from same tag
- Chart.js Legend not showing
- The expected type comes from property 'XAxes' and 'yAxes' which is declared here on type '_DeepPartialObject<{ [key: string]:
- Charting Commodity Data - Issue getting the dates and values in JSON
- Remove the label and show only value in tooltips of a bar chart
- Chart.js: One function for multiple graphs
- Long text in x-axis is cut in bar graphs ng2-charts
- ChartJS: Percentage labels
- How to use Chart.js to draw mixed Financial / Candlestick and Bar Chart?
- How to access all data in a function with ChartJs?
- Chart.js how to create chart wirhout y-axis for two data sets
- Chart.js Radial axes: is it possible to use multiple axes on radar chart?
- Chart.JS Can not read property '_meta' of Undefined
- Chart.js date formatting use for
- chart.js - display control timescale time zone
- Connect 2 line in chart using chartjs
- Chart.js: stack the bars to the left
- Why is only a single chart of three updated with react-chartjs-2?
- chart js - Apply different color for each x-axes label
- Add multiline labelString to yAxes Chart.js
- Contrast chart.js datalabels colors with the background
- Iterating through array in Chart.js data field
- Chart.js tooltip values display in two lines
- How to create datasets for all labels for stacked bar in chart.js?
- Chart tooltip should show the consolidated information of a single bar in double bar chart
- How to write better code in es6 for formatting an object with array values
- How to display Tooltip without hovering pie chart with Chart.JS
- ChartJS Generate Date Format
- How to register plot or label click event in chart.js
- How to mapping variable data for pie chart (react.js)
- ChartJS donut chart clipping the edges