score:7
Accepted answer
@yavg Please check bellow screenshot. many labels are duplicated. don't add duplicate label like this. try to add 24 hours time as my answer
I think you expected like this.
var ctx = document.getElementById("canvas").getContext('2d');
var myChart = new Chart(ctx, {
type: 'bar',
data: {
labels:
["08 Aug 2018 14:42","09 Aug 2018 11:24","04 Sep 2018 13:23","04 Sep 2018 13:26","04 Sep 2018 13:31","04 Sep 2018 13:33","04 Sep 2018 13:35","04 Sep 2018 13:36","04 Sep 2018 13:38","04 Sep 2018 13:39","04 Sep 2018 13:40","04 Sep 2018 13:45","04 Sep 2018 13:46","04 Sep 2018 13:49","04 Sep 2018 13:50","04 Sep 2018 13:51","04 Sep 2018 13:53","04 Sep 2018 14:07","04 Sep 2018 14:19","04 Sep 2018 14:20","04 Sep 2018 14:21","04 Sep 2018 14:30","04 Sep 2018 14:31","04 Sep 2018 14:33","05 Sep 2018 09:30","05 Sep 2018 09:31","08 Aug 2018 14:43","09 Aug 2018 11:25","04 Sep 2018 13:22","04 Sep 2018 13:27","04 Sep 2018 13:32","04 Sep 2018 13:34","04 Sep 2018 13:37","04 Sep 2018 13:41","04 Sep 2018 01:40","04 Sep 2018 01:41","04 Sep 2018 01:42","04 Sep 2018 01:45","04 Sep 2018 01:46","04 Sep 2018 01:49","04 Sep 2018 01:50","04 Sep 2018 01:51","04 Sep 2018 01:53","04 Sep 2018 02:07","04 Sep 2018 02:19","04 Sep 2018 02:20","04 Sep 2018 02:22","04 Sep 2018 02:36","04 Sep 2018 02:32","04 Sep 2018 02:35","05 Sep 2018 10:31","05 Sep 2018 10:32"],
datasets: [{"label":"Estatura (cm)","backgroundColor":"rgba(0, 100, 150, 0.5)","pointBorderColor":"rgba(26,179,148,1)","data":["68.00","69.00","70.00","71.00","72.00","73.00","74.00","75.00","76.00","77.00","78.00","79.00","80.00","81.00","82.00","83.00","84.00","85.00","86.00","87.00","88.00","89.00","90.00","91.00","68.00","69.00","70.00","71.00","72.00","73.00","74.00","75.00","76.00","77.00","78.00","79.00","80.00","81.00","82.00","83.00","84.00","85.00","86.00","87.00","88.00","89.00","90.00","91.00"]}]
},
options: {
legend: {
position: 'top',
},
scales: {
xAxes: [{
ticks: {
autoSkip: true,
maxRotation: 0,
minRotation: 0
}
}]
},
pan: {
enabled: false,
mode: 'xy' // is panning about the y axis neccessary for bar charts?
},
zoom: {
sensitivity:0.5, drag: false, enabled: true, mode: 'x'
}
}
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/hammer.js/2.0.8/hammer.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.6.0/Chart.min.js"></script>
<script src="https://npmcdn.com/Chart.Zoom.js@0.3.0/Chart.Zoom.min.js"></script>
<canvas id="canvas" height="180"></canvas>
Source: stackoverflow.com
Related Query
- reset the zoom to the initial in chart.js?
- Skipping the initial animation of a line chart
- 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
- How to set up an initial Zoom value for a chart (ChartJS + ChartJS Zoom plugin)?
- Getting the HTML code of a chart created by chart.js
- How to add text inside the doughnut chart using Chart.js?
- Remove the vertical line in the chart js line chart
- Moving vertical line when hovering over the chart using chart.js
- How do you hide the title of a chart tooltip?
- Dynamically update the options of a chart in chartjs using Javascript
- Chart.js line chart is cut off at the top?
- How to add text in centre of the doughnut chart using Chart.js?
- Making the labels responsive in chart js
- chart js tooltip how to control the data that show
- Chart js. How to align text by the center of the tooltip?
- ChartJs bar chart - keep bars left instead of equally spread across the width
- Chart looks only grey, does not show the color - Chartjs,discordjs
- Border radius for the bar chart in ChartJS
- Chart JS show multiple data points for the same label
- How do I change the 'months' language displayed on the date axis in Chart JS?
- Add all data in the tooltip of Chart JS
- How to align Chart.JS line chart labels to the center
- How to hide the y axis and x axis line and label in my bar chart for chart.js
- How can I remove extra whitespace from the bottom of a line chart in chart.js?
- How to display the labels in doughnut chart using ng2 charts?
- Remove the label and show only value in tooltips of a bar chart
- Chart Js Show the old data on mouse hover
- ChartJS: Show all labels of a mixed chart in the tooltip
- React ChartJS 2 : Get data on clicking the chart
- Grouping the object by key for Chartjs bar chart
More Query from same tag
- Chart.js (line chart) tooltip duration/delay
- Chart.js unable to display data
- How to start Y Axis Line at 0 from right for negative values in chart js 2?
- Chart Js flickering or switching as i move mouse on canvas
- Chart.elements.Rectangle.prototype.draw inpacting on other charts in the same page(Angular)
- how to make scrollable the legends of pie chart ( chart js )
- Pie chart legend styling using Chart js
- padding not working in my chartjs line-graph
- how to filter year from datefield in django
- Why Chart.js's tooltip appears in wrong position when mouse hover?
- Creating charts using chart.js
- How to set chart's percentageInnerCutout property with ng2-charts
- What library should I use to create costume chart in react native?
- Extension for chart.js 2.X
- Setting Limits on Chart.JS
- Scatterplot with 4 labels (Opposite Diagram) in any js library?
- chart.js dynamically add y axes from json
- Bar chart from Chart.js not showing the second dataset
- how do i use the numbers i key in from a form as the input data for chartjs
- What kind of graph could I use to achieve this with ChartJS (or similar)?
- How to use Chart.js to draw mixed Financial / Candlestick and Bar Chart?
- Legends in Chart.js, shows only one label
- Intersection point in line graph in Chart.js?
- How to display the more then one value inside tooltip in bar chart.js?
- Horizontal Bar-Chart - angular-chart.js
- DevExtreme Exporter prints blank page
- Ajax automatically placing double quotes around variable data returned in success call
- Remove padding from chartJs horizontal bar chart
- Tick - no negative
- Chart.js beginAtZero doesn't work