score:0
the best thing you can do is manipulate your data beforehand by removing the duplicate values from your data array, the other option you can use is the object notation in combination with a linear x axis, this will still plot the point double but it will put it in the same place
var options = {
type: 'line',
data: {
datasets: [{
label: '# of votes',
data: [{
x: 79,
y: 80
}, {
x: 80,
y: 81
}, {
x: 80,
y: 81
}, {
x: 81,
y: 77
}],
fill: false,
bordercolor: 'rgb(75, 192, 192)',
tension: 0.1
}]
},
options: {
scales: {
xaxes: [{
type: 'linear'
}]
}
}
}
var ctx = document.getelementbyid('chartjscontainer').getcontext('2d');
new chart(ctx, options);
<body>
<canvas id="chartjscontainer" width="600" height="400"></canvas>
<script src="https://cdnjs.cloudflare.com/ajax/libs/chart.js/2.9.4/chart.js"></script>
</body>
Source: stackoverflow.com
Related Query
- Line chart plotting multiple points for duplicate data on x and y axis using chart.js
- How do you set x and y axis and Title for a line chart using charts.js?
- Multiple axis line chart with Chart.js and JSON data from Google Sheet
- Chart JS show multiple data points for the same label
- How to hide the y axis and x axis line and label in my bar chart for chart.js
- In Chart.js >3.0, on axis of type time, how to show labels and ticks only for existing data points (make labels reflect data)?
- Displaying line chart for multiple months using chart.js
- Chart.js combined line and bar chart with differing data points
- How to plot a line chart which has both the start and points outside the canvas area using Chart.js
- I am using chart js to draw a chart. I did everything right but i don't know why the x axis and y axis label is not comming in chart. code below
- Displaying line chart for multiple datasets using chart.js
- Using custom dataformat in chart.js for Multi Axis Line Chart
- Line chart: align x axis (timestamps) for multiple data sets
- Chart for Real time data with duplicate x axis
- Chartjs v2 - format tooltip for multiple data sets (bar and line)
- Chartjs 2 - Stacked bar and unstacked line on same chart with same y axis
- show label in tooltip but not in x axis for chartjs line chart
- How to add second Y-axis for Bar and Line chart in Chart.js?
- Show X axis on top and bottom in line chart rendered with Chart.js 2.4.0
- ChartJs line chart - display permanent icon above some data points with text on hover
- How to use 'time' (data from database, data type: timestamp ) for plotting graph in Chart JS
- X-axis multiple colored label for bar chart using chart.js
- Multiple line labels for chart js
- How to show data values in top of bar chart and line chart in chart.js 3
- ChartJS (React) Line Chart - How to show single tooltip with data and labels from 3 (multiple) dataset?
- Missing Tooltip for some data points using chartjs
- Add data to line chart using chart.js
- How to draw outer labels for polar chart using ng2-charts and chart.js at fixed positions outside the rings?
- add info for points in line chart (js)
- chart data on 24hr X axis using recharts, chart.js, I don't mind what
More Query from same tag
- ChartJS: Percentage labels
- Vue.js Vue-chart.js linear gradient background fill
- Bars centered between the grid lines with the label below the grid lines (chart.js)
- How to show slice value inside of slice in pie chart using chart.js
- How to fix bar width in chartjs?
- ChartJS - x axis labels orientation
- chart.js bar chart change color based on value
- How to use plugin in chartjs-node?
- How to trigger ChartJS legend onClick with out interrupting its normal working
- chart.js: set specific numbers in y-axis
- Chartjs doughnut chart for conditional data
- Chart JS remove x-axis and y a-xis visibility
- How to sort XY line chart tooltip items based on value and add thousands separators?
- Is there a way to filter data in Chart.js?
- How to export report as PDF/CSV in ChartNew.js
- vue.js vue-chartjs chart not updating when chartData replaced, updated etc
- How to rotate custom marker in chart.js?
- Showing points data withou hover chartjs
- Cannot change font color and box width in chart
- How to set minimum value to Radar Chart in chart js
- iframes without sandbox attribute is a Vulnerability
- Chart JS tooltip label not showing correct value
- Realtime data from a service in ionic / angular
- display various chart value and tool tip
- Issues with react-chartjs-2
- How to set y axis to the max dataset value in Chartjs?
- Chart.js - Setting x-axis based on user input
- How to export a chart in Excel and PDF format using Chart.js
- Editing Chart.js legend template
- drawing bar chart with Chart.js