score:0
public seriesB: Array<number> = [
59.023,
59.023,
59.034,
59.034,
59.034,
59.039,
59.05,
59.061,
59.088,
59.104,
500
];
public lineChartLabels: Array<any> = [
"January",
"February",
"March",
"April",
"May",
"June",
"July"
];
public lineChartOptions: any = {
title: {
display: true,
text: "Line Chart Example"
},
legend: {
position: "bottom"
},
scales: {
yAxes: [`k`
{
id: "SeriesB",
ticks: {
stepSize: 84,
min:0
}
},
]
}
};
public lineChartColors: Array<any> = [
{
backgroundColor: "rgba(255,255,255,0.2)",
borderColor: "rgba(1,1,1)"
}
];
public lineChartData: Array<any> = [
{ data: this.seriesB, label: "SeriesB", yAxisID: "SeriesB" }
];
public lineChartLegend: boolean = true;
public lineChartType: string = "line";
this.lineChartOptions.scales.yAxes[0].ticks.suggestedMin = Math.floor(
Math.min(...this.seriesB)
);
this.lineChartOptions.scales.yAxes[0].ticks.suggestedMax = Math.ceil(
Math.max(...this.seriesB)
);
);
score:4
It seems quite a long, but you can use below code to change the steps and max value based on input data.
ticks: {
min: 0,
callback: function(value, index, values) {
if (Math.floor(value) === value) {
return value;
}
}
}
Source: stackoverflow.com
Related Query
- How to set ticks on axes dynamically with chart.js?
- How to dynamically set ChartJs line chart width based on dataset size?
- ng2-charts: How to set Title of chart dynamically in typescript
- How to set X coordinate for each bar with react chart js 2?
- How to create dynamically chart for Ionic App with Firebase data?
- How to update the chart dynamically with vue-chartjs?
- Dynamically set chart type with Angular Chart?
- How to dynamically update data of line chart used with chart Js?
- How to configure chart.js line chart with very low minimum height, and only 0 and 1 (no decimals) as ticks on the y-axis
- How to set data values as labels in Chart.js with a Radar Chart
- Chart.js - How to set a line chart dataset as disabled on load
- chart js 2 how to set bar width
- How can I create a horizontal scrolling Chart.js line chart with a locked y axis?
- Chartjs random colors for each part of pie chart with data dynamically from database
- How to prevent first/last bars from being cut off in a chart with time scale
- How set color family to pie chart in chart.js
- chartjs : how to set custom scale in bar chart
- How to fix chart Legends width-height with overflow scroll in ChartJS
- How to display Line Chart dataset point labels with Chart.js?
- chart js how to fill legend box with colour
- How do I draw a vertical line on a horizontal bar chart with ChartJS?
- chartjs: How to plot multi-line chart with irregular intervals
- How to display inline values in a stacked bar chart with Chart.js?
- Chart.js Dynamically Updating Chart with X Axis Time
- How to display data labels outside in pie chart with lines in ionic
- ChartJS:align zeros on chart with multi axes
- how to set chart.js grid color for line chart
- How can I display a set amount of ticks on the Y Axis?
- How to dynamically use chartjs-plugin-annotation with ng2-charts?
- How do you set pie chart colors in angular-chart.js
More Query from same tag
- Why is each character displayed on a new line/row?
- Change point color on click using ChartJS
- Unwanted line chart ''shadow" using chart.js
- chart js how do I only show just the low/high dots on line chart?
- How to share same background color for multiple dataset in a chart?
- How do you plot scatter graph with chart.js
- ChartJs create Chart from array
- Chart.js 3.x custom positioners: cannot use them in TypeScript
- new dataset is not accepted by chartj template
- Long text in x-axis is cut in bar graphs ng2-charts
- ChartJS - handling of overlapping points in line chart
- Vertical scrubber line using chartjs
- How to get the setState reassigned in react
- Horizontal stacked angular bar charts
- Chartjs create chart with big data and fixed labels
- Datetime picker in Chart.js
- Display all tooltips in chartjs
- Can't display data labels in chartJS
- How to put arguments in a jchart.Chart class
- I want to multiply chart data according as array length
- change long labels to multiline(wrap) label in ChartJs
- Chartjs: How to offset ticks on radarchart?
- Drawing a doughnut chart with columns inside to represent hourly stats in chart.js
- Chartjs Line chart options display increase and decrease percentage between each datapoint
- Update of options for PrimeNG Chart needs two calls instead of one
- Draw line between starting point and Ending point in semi doughnut chart in chart js
- Chartjs inverted bars when negative value
- Chart.js v2 charts do not display inside angular 2 (but Chart.js v1 works perfectly)
- Add text before time in tooltip
- Bubble getting cut off in Chart.js