score:1
Check out the Scatter chart extension (http://dima117.github.io/Chart.Scatter/) - listed under Community Extensions at http://www.chartjs.org/docs/#advanced-usage-community-extensions.
This supports number scales.
score:1
if you want to update a array use in js :
var aChartDataMoy = [];
for (i = 0; i < nbTamis; i++) {
aChartDataMoy.push({
'x': parseFloat(aTamis[i]),
'y': parseFloat(aMoyenne[i])
});
}
and
datasets: [{
label: "Moyenne",
borderColor: 'rgb(229, 57, 53)',
borderWidth: 1,
fill: false,
data: aChartDataMoy
}
score:14
If you wanted, you could use the 'scatter'
chart type (which was relatively recently introduced), or just override the default X-axis type to make it 'linear'
instead of the default 'category'
setting ('time'
and 'logarithmic'
are other options).
However, if you take this approach, you will need to change your data format:
var data = {
// No more "labels" field!
datasets: [{
label: "My First dataset",
fillColor: "rgba(220,220,220,0.5)",
strokeColor: "rgba(220,220,220,0.8)",
highlightFill: "rgba(220,220,220,0.75)",
highlightStroke: "rgba(220,220,220,1)",
data: [{x:1,y:10},{x:2,y:20},{x:4,y:30},{x:8,y:40}] // Note the structure change here!
}]
}
You will also need to make sure (if you continue using 'line'
as the chart type) that you override the options:
var options = {
scales: {
xAxes: [{
type: 'linear',
// ...
}]
}
}
There may be more steps required than are shown in this answer (I haven't mocked this up and I don't know your existing options), but these are the main steps.
Source: stackoverflow.com
Related Query
- Numeric X axis for linechart
- How to set max and min value for Y axis
- show label in tooltip but not in x axis for chartjs line chart
- ng2-charts: How to set fixed range for y axis
- Chart JS - set start of week for x axis time series
- Add a second Y-axis for Linechart in Chart.js?
- How to show Y axis ticks for every point in the graph
- How to hide the y axis and x axis line and label in my bar chart for chart.js
- Chart js different background for y axis
- how to change Y axis value dynamically based on user input in Chartjs for Line chart?
- Non numeric for x-axis in scatter chart in CHART.js
- chartjs custom y axis values, different text for each one
- 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)?
- Chart.js: Can't get a coordinate for value for x axis unless x axis has the exact same value
- How do I add time sourced from an external source as an X axis to a ChartJS graph?
- End x-axis on last data point (scatter plot) for x,y numeric values
- Minimum value for x Axis doesn't work for horizontal bar chart | ChartJS
- Using chartjs v2 to show categorical values on axis instead of numeric
- Adding a Date adapter for Time Cartesian axis from a cdn
- How to draw multiple line on y axis for same x axis in chartjs v2?
- How to change fonts and axis labels for Chart.js image rendering with QuickChart?
- Chart Js reduce text size for label on X axis
- chart.JS i want to put different color for each Y axis value grid line color
- Chart.js - changing tick / label positions for x axis time series
- Linear x axis for bar chart chartjs
- Chart.js two y axes line chart tooltip value incorrect for 2nd y axis
- How to write better code in es6 for formatting an object with array values
- Is it possible to have a decimal X axis for a line graph?
- How do you set x and y axis and Title for a line chart using charts.js?
- Problem with script src for Chart.js. The CDN for Chart.js funtions fine, so my code is ok. Somehow I'm not linking the file correctly
More Query from same tag
- Bug in canvas class in chart js
- Legends in Chart.js, shows only one label
- How to join two objects in array
- Highlight last clicked bar in ChartJS
- Chart.js - Responsiveness not correctly working on device orientation change
- update chart in chart js without reloading the page
- How to add datas to chart js from javascript array itself?
- Chart.js scatter chart stops working after extending to multiple datasets
- Adding custom title in tooltips of chart.js
- Have the current zoom information in chart.js with zoom plugin
- How to display legend in toolbox in Charts.js?
- hide dataset by default using Chart.js and a custom script
- Vertical spacing in horizontal ChartJS Bar Graph
- NPM module doesn't work with Webpack 3 but works with vue-cli3 which based on Webpack 4
- Tooltip callbacks in line chart JS not working
- Chartjs: I only want left and right padding in pie chart
- Small value in doughnut chart is not visible - Chartjs
- Angular 2 ng2-charts donut add horizontal line
- Draw line on Chart.js bar
- How to convert a bar legend to line legend in chart.js 2.7.2?
- How do I hide line outside the min/max (scale area) in chartjs 2.0?
- chartjs - how do I add border radius on bottom corners
- chart.js one of the chart from mixed chart is not plotting
- Deleting and recreating an element with React
- ChartJS does not render correctly
- $scope.chart undefined in angular-chart
- chart.js-plugin-annotations multiple horizontal lines in one chart
- How can I move chartJs legend left side and change the width and Hight of the chart?
- How to align bars in bar chart - Chart.js
- Horizontal Stacked Bar with Gaps