score:1
Yes you can do the same by using tickOption in the y Axes
public barChartOptions: ChartOptions = {
responsive: true,
showLines: false,
tooltips: {enabled: false},
animation: {duration: 2000},
scales: {
yAxes: [{
gridLines: {
display:false
},
display: false,
ticks: {
max : 100,
min: 0
}
}]
}
};
Also, steps
and stepValue
is not working and I checked the same in their library its not written there also.
barChartData: ChartDataSets[] = [
{
data: [40, 30, 30],
"backgroundColor": this.bgColors
}
];
In the above, I need only y bar graphs so I set the data like that and for the three values, I used the same size of barChartLabels.
barChartLabels: Label[] = ['A', 'B', 'C'];
This works for me, I hope it will work in your code too :)
score:4
In my name.component.html:
<div style="display: block">
<canvas baseChart height="100" [datasets]="lineChartData" [labels]="lineChartLabels" [options]="lineChartOptions"
[colors]="lineChartColors" [legend]="lineChartLegend" [chartType]="lineChartType"></canvas>
In my name.component.ts:
public lineChartOptions: any = {
scales : {
yAxes: [{
ticks: {
beginAtZero: true,
stepValue: 10,
steps: 20,
max : 50,
}
}]
}
};
score:7
Try adding the following to your chart options:
scales : {
yAxes: [{
ticks: {
steps : 10,
stepValue : 10,
max : 100,
min: 0
}
}]
}
Source: stackoverflow.com
Related Query
- ng2-charts: How to set fixed range for y axis
- How to set max and min value for Y axis
- ChartJS: How to set fixed Y axis max and min
- How we can set our own colors for each label in charts
- How do you set x and y axis and Title for a line chart using charts.js?
- How to set min max for x axis depend on data with Chartjs and Spring Boot?
- How to set max/min on x axis to display time range in Chart.js?
- The dataset for bar graph is not set properly using ng2 charts and ng5-slider in Angular
- How to set ChartJS Y axis title?
- Charts JS: How to set units?
- How to set default colour for bars in Chart.js
- Chart JS - set start of week for x axis time series
- 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
- How to set a full length background color for each bar in chartjs bar
- Chart.js Pie Chart: How to set background image for segment
- how to change Y axis value dynamically based on user input in Chartjs for Line chart?
- how to set chart.js grid color for line chart
- Chart.js how to set cutoutPercentages for each dataset
- ChartJS How to set max labels for X axis?
- How to set colors for Chart.js tooltip labels
- How to set lower limit for the highest value being displayed on Y Axis?
- how to set color for each item in tooltip with ChartJS
- How to draw outer labels for polar chart using ng2-charts and chart.js at fixed positions outside the rings?
- 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)?
- How to use chartjs-plugin-datalabels for specific charts using vue-chart.js
- How do I add time sourced from an external source as an X axis to a ChartJS graph?
- chartjs - how to set the order in which the different charts are displayed
- Chart.js - Draw charts with opposite bars - How to set both the y-axis ends to positive number?
- How to retain spacing between bars for two different bar charts in Chart.js 2
More Query from same tag
- Chart.js doesn't animate on first load
- How can I make bar charts symmetrical in chart.js?
- Chart.js: Some sectors not showing if difference is too big
- Connecting Two Datasets in Chart.js Into a Single Line
- How to align multiple x axes in chart.js?
- How can make my chart.js dynamic using data from database
- graph of an equation animated javascript (crash game)
- How to put an image a circle chart
- Ajax call to trigger a controller function
- How do you limit the blur in a linear gradient on a canvas?
- Displaying multiple line graphs on one page
- Chart.js - Uncaught ReferenceError: chart is not defined
- Using ticks 'major' with Chart.js is overlapping with an unknown text
- Does the min value of the xAxes have to be within the dataset
- what is the correct way to destructure a nested json object with fetch?
- How can I prevent the hover data from displaying in Chart.JS?
- How to add new x axis in chart JS?
- Highlight background on a single hour with chart.js and annotations
- How to make label always visible on DoughnutChart.js
- How to set max and min value for Y axis
- Can't create separate charts using chart.js
- Links in bar charts (charts.js)
- [MIXED CHART.JS]How do I manipulate the label of each chart's tooltips?
- How to make custom text appear underneath each bar in chartjs bar chart?
- Problems displaying yLabels in charts.js
- ChartJs in endless loop
- Charting with chartjs, can't get it working correctly
- How to draw round edges with chart.js for line diagrams
- Chart.js flickering
- Doughnut chart adjusting problem in chart.js