score:4
Accepted answer
You are unexpectedly closing off the options property, before setting all the options.
Here is the correct syntax :
var ctx = document.getElementById('cvtree').getContext('2d');
var chart = new Chart(ctx, {
type: 'bar',
data: {
labels: yoylabels,
datasets: [{
label: 'Pay By Person',
backgroundColor: 'rgba(0, 129, 214, 0.8)',
data: numericdollarvals
}]
},
options: {
legend: {
display: false,
position: 'top',
},
scales: {
yAxes: [{
ticks: {
beginAtZero: true,
callback: function(value, index, values) {
if (parseInt(value) >= 1000) {
return '$' + value.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
} else {
return '$' + value;
}
}
}
}]
}
}
});
Source: stackoverflow.com
Related Query
- Chart.JS Can not read property '_meta' of Undefined
- Can not read property 'Concat' of Undefined
- Chart Js Cannot read property 'length' of undefined
- chartjs - multi axis line chart - cannot read property 'min' of undefined
- Angular / ng2-charts: Fetching json data in chart object showing: Cannot read property 'length' of undefined
- Uncaught TypeError: Cannot read property 'draw' of undefined : Angular chart js
- Chart JS Error : Uncaught TypeError: Cannot read property 'top' of undefined
- Uncaught TypeError: Cannot read property 'offsetWidth' of undefined - chart.js
- Chartjs cannot read property datasets of undefined
- TypeError: Cannot read property 'defaults' of undefined when using the react wrapper of chartjs
- Cannot read property 'labels' of undefined
- Chart.js Cannot read property 'fontSize' of undefined
- TypeError: Cannot read property 'legend' of undefined | Angular + ng2-charts
- ChartJS: Uncaught TypeError: Cannot read property 'call' of undefined
- Uncaught TypeError: Cannot read property 'draw' of undefined
- Ionic/Chart.js - Cannot read property 'nativeElement' of undefined
- Updating Chart.js with JSON, cannot read property 'length' of undefined
- chartjs & asp.net: Cannot read property 'labels' of undefined
- Cannot read property 'reactiveProp' of undefined in vue-chartjs
- react-chartjs integration error. Cannot read property 'xLabels' of undefined
- Chartjs + Vue.js - Cannot read property '_meta' of undefined
- chartjs; cannot read property '0' of undefined
- Datalabels of Chart JS can not display full values
- Chart.js Cannot read property 'apply' of undefined
- Using Chart.js onClick function, can you execute code from an undefined or null result?
- Cannot read property 'length' of undefined for ChartJS when I use it inside React
- fill: 'origin' property does not work for my chart
- react-chartjs error Cannot read property 'Chart' of undefined
- Uncaught TypeError: Cannot read property 'draw' of undefined for object scale
- ERROR TypeError: Cannot read property 'testMethod' of undefined
More Query from same tag
- Need help splitting date to new line in Doughnut Chart js
- Chart.Js - Hightligh an area in the background
- How to add panning to chart in chartjs?
- javascript chart.js remove last point
- Chartjs bar min, max and avarage value
- Dynamically set chart type with Angular Chart?
- How I can change the font-family of labels in the bar chart?
- Chart.js: call method outside of onRefresh() method
- ChartJS change background color by conditions
- is it possible to get time in box charts in chartjs?
- Chartjs with Vue, Bar Chart Border Radius not working
- Change mouse cursor to pointer in charts js
- Chartjs xaxes tick min
- Chart js. How to align text by the center of the tooltip?
- Vertical scrubber line using chartjs
- How to use Selenium with "chart.js"
- Bar Graph, chart.js PHP Will Not Load
- ChartJS: Update tooltip
- JavaScript ChartJS Array Issue
- Json data visualization in Javascript with chartjs
- ChartJS doughnut chart not displaying colours
- Chart.js 2.0 - Tooltip is showing incomplete data on hover
- How to set gradient in legend box color in Chart,js
- How to use two datasets in chart.js doughnut chart?
- Display JSON data in chartjs
- react-chartjs-2 keep x axis always 0% to 100%
- Limit numbers of labels on Chart.js in "smaller display only"
- How can I use an array of {x,y} objects to make a chart?
- old yAxis ticks do not get removed (chartjs, react-chartjs-2 wrapper)
- Chart.js Line graph legend yields error: Uncaught TypeError: Cannot read property '0' of undefined