score:1
Accepted answer
in order to put your own labels in the 'y' axis you have to use the tick options, scale label will only modify the label of the axis of the whole, so let's say you want to add a label for your y axis, like 3000$ instead of only 3000.
you need to use this.
ticks: {
callback: function(value, index, values) {
//your function here
}
}
in this example i wanted to return 3 states for each value, like a ticket system.
$scope.options = {
scales: {
yAxes: [{
scaleLabel: {
display: true,
labelString: 'Estado'
},
ticks: {
min: 1,
max: 3,
stepSize: 1,
callback: function(value, index, values) {
if(value == 1){
var dasLabel='Ticket open';
}
if(value == 2){
var dasLabel='Attending ticket';
}
if(value == 3){
var dasLabel='issued resolved';
}
return dasLabel;
}
}
}] ,
xAxes: [{
scaleLabel: {
display: true,
labelString: 'Hora'
}
}]
}
};
and your markup
<canvas id="line" class="chart chart-line" chart-data="axis"
chart-labels="myLabels" chart-series="series" chart-options="options"
</canvas>
Source: stackoverflow.com
Related Query
- how can i modify scale labels in angular chart js?
- How can I style scale numbers in a Polar Area chart (chart.js)
- how can i show labels and value in both on bar chart
- How can I modify category labels font size in Chart.JS V2?
- How Can I Get An Instance of a ChartJS Bar Chart Using Angular
- How can labels/legends be added for all chart types in chart.js (chartjs.org)?
- How can I create a horizontal scrolling Chart.js line chart with a locked y axis?
- How do I prevent the scale labels from being cut off in chartjs?
- How can I make two of my lines in Chart JS thicker
- How to prevent first/last bars from being cut off in a chart with time scale
- How to modify chartjs tooltip so i can add customized strings in tooltips
- Chart.js how to show cursor pointer for labels & legends in line chart
- chartjs : how to set custom scale in bar chart
- How can I make a stepline or stepped chart in chart.js or D3?
- How to display Line Chart dataset point labels with Chart.js?
- How I can prevent of labels overlapping on mobile screen Chart.js
- How to display data labels outside in pie chart with lines in ionic
- How to align Chart.JS line chart labels to the center
- How to access labels array using chart plugin (Chart.pluginService.register) in Chartjs 2.x?
- 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?
- Ng2-charts / chart.js - how to refresh/update chart - angular 4
- Chart.js Radar Chart How to Remove Outer Labels
- Chart js: how can I align the legend and the title
- How can I display the xAxes and yAxes data in the tooltip, Chart JS?
- How can I trigger the hover mode from outside the chart with charts.js 2?
- How to update data Chart in async way in Angular Chart.js?
- Show labels on each sector to polar chart using angular js chart
- How to set single color on each bar in angular chart js
- How can I add some text in the middle of a half doughnut chart in Chart.JS?
More Query from same tag
- Annotations are not displayed in Chart.js
- Chart.js do not display in Boostrap tabpanel
- responsive = false not working
- chartjs-plugin-annotations not displayed in primeNG chart
- how to Highlight clicked Doughnut section or portion in chart.js?
- How to implement chart.js in Django?
- How can I make line on chart thinner?
- Set Tooltip over line Chartjs
- I'm trying to use chart.js in angular to create a simple bar chart but I'm getting an error as 'legend' type doesn't exist for options
- Zoom chartjs with many X values
- ChartJs - pie chart not showing
- Chartjs + jsPDF = Blurry image
- ng-charts not updating labels when chart data is updated at same time
- Moving Data To Object Within Array
- react-chartjs-2 (chart.js) Radar - Remove values?
- Chart.js change legend toggle behaviour
- Example: Doughnut | Error: Uncaught ReferenceError: Utils is not defined
- ChartsJS Legend not showing in Angular11
- Passing Labels from PHP to Chart.js
- How to create a line chart indicating which month a user wrote more or less blogs?
- Cannot read property 'map' of undefined when looking at an array with no index
- How to align multiple x axes in chart.js?
- How to wait for all items to load within ng-repeat before then rendering a chart for each item
- Keep two Pie Charts Side by Side
- how to set color for each datapoint in chartjs-chart-treemap
- Chart.js and long labels
- chart.js onClick event function, access angular component
- how to pass function variable from one file to another in react
- Chartjs - line chart display with addData() is bugged?
- Chartjs.org Chart only displaying in one page