score:17
Accepted answer
LabelResult is an array, change
labels: [LabelResult]
to
labels: LabelResult
Also:
data: [DataResult]
to
data: DataResult
Like:
var myChart = new Chart(ctx, {
type: 'bar',
data: {
labels: LabelResult,
datasets: [{
label: '# of Votes',
data: DataResult,
borderWidth: 1
}]
}
});
score:3
I think you could try to remove some brackets.
while(count > 0){
LabelResult[counter] = Data[counter].TIME; // here removed brackets
counter++;
count --;
}
and
data: {
labels: LabelResult, // here removed brackets
datasets: [{
label: '# of Votes',
data: DataResult, // here removed brackets
borderWidth: 1
}]
},
I hope that will works.
Source: stackoverflow.com
Related Query
- using array values in chart.js data and label field
- Using number/text input field to set the data values in ChartJs stops the chart from being displayed
- I am using chart js to draw a chart. I did everything right but i don't know why the x axis and y axis label is not comming in chart. code below
- How can I build some chart with Chart.js and ng2-charts using an array of revenus & budgets per month date as Data source?
- using dynamic array in chartJs for label and data
- Chart.js Timeseries chart - formatting and missing data values
- Chart JS: Ignoring x values and putting point data on first available labels
- Adding custom text to Bar Chart label values using Chart.js
- How to show data values in top of bar chart and line chart in chart.js 3
- Rendering Chart.js Bubble Chart Using Array Data
- Custom label from using separate array in Chart JS
- How can I get my Chart.JS bar chart to stack two data values together on each bar, and print a calculated value on each bar?
- Chart Piechart in only show percentage on hover but it shows data and label with percentage both i just want to show percentage only percentage
- Generate bar chart using chart.js and associative array
- Many Flots using ChartJS and Ajax get data values
- Chartjs using array in label field
- How to show symbols after the label and before the numeric value using chart.js Bar chart in Angular
- Create a pie chart using an array from a data table in chart.js
- Line chart plotting multiple points for duplicate data on x and y axis using chart.js
- Chart.js returns a console error and does not display the chart when using variables as data input
- Passing data to a chart javascript object and array
- Get data from SQLite as an array and generate charts with the data using Chart.js in an HTML
- How to take data from an API and create a chart on that using Chart.js and Angular 8?
- Bar Chart cannot read data and label in laravel
- How to seprate label and total value using array and pass to view
- ChartJS - Draw chart with label by month, data by day
- line chart with {x, y} point data displays only 2 values
- How to save Chart JS charts as image without black background using blobs and filesaver?
- Chart.js bar chart : Grid color and hide label
- Chart JS show multiple data points for the same label
More Query from same tag
- Chart.js different scaleLine color of radar chart (angular)
- Changing grid color in radar chart
- Conditional Series Failing - Chart.js
- Chartjs plugin label in Angular app moving unexpectedly at hover
- How can I set a class to a HTML element which is created by custom tooltip function?
- How to pass values to a chart (chart.js / morris.js)
- Angular with ng2charts for bar chart shows NAN% when no data present
- How to hide tooltips with their respective dataset
- Bar Chart Not Stacking When Using ChartJs
- Fix the height of Y-Axis of Bar chart in chart.js?
- Why can't I update the aspectRatio within the chartjs chart?
- Html5 web page with chartjs: loading an external json file and create a line chart
- Ionic using multiple chart.js canvas in the same page
- Dynamically update chart in chartJs
- Offset left or right of the tooltip chartsjs
- How can I create a horizontal scrolling Chart.js line chart with a locked y axis?
- Chart.JS TypeError: this.scale is undefined
- chart.js on animation end callback
- Price history with chart js
- how to use chart.js in angular 7
- Implementing Data Decimation in vue chartjs
- Showing only entire units on ChartJS
- How to make 2 bar in a certain section of chart
- Chart.js legend style
- ChartJS - Gradient color overlap
- chart.js 2, animate right to left (not top-down)
- Destroy chart.js bar graph to redraw other graph
- Tooltip alignement with Chart.js v2
- Binding Chart to Canvas height width
- Chart.js drag points on linear chart