score:0
Try to passing your data from tag body to tag script
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<script src="https://cdn.jsdelivr.net/npm/chart.js@2.8.0"></script>
<title>Documment</title>
</head>
<body>
<div class="container">
<canvas>
</canvas>
<p id="data" style="display:none"><%= value %></p>
</div>
</body>
<script>
// your data change to string
let data = document.getElementById("data").innerText
let array = data.split(',')
</script>
</html>
Source: stackoverflow.com
Related Query
- Get data from SQLite as an array and generate charts with the data using Chart.js in an HTML
- How to get chart from data points (arrays) with inconsistent time intervals and chart.js?
- How to reuse a Chartjs Chart component in with different Data and get past the **Canvas is already in use** error?
- 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 data from API with Chart JS
- How do I keep chart.js charts in one JS file, and not get errors when the ID from the JS file don't exist on one specific html page?
- ChartJS (React) Line Chart - How to show single tooltip with data and labels from 3 (multiple) dataset?
- How to achieve the best possible performance with mutable data and real-time charts in React?
- How do I customize y-axis labels and randomly pick the value from the data range for x-axis in Chart js
- Update the chart data from an array stored in a variable on button click
- How to get Data from API to display chart using chartjs in Vuejs
- How to get the data attribute of the canvas chart created using chartjs
- Visualization of charts using real time data from MSSQL with node.js webserver
- The chart doesn't display the data from my call to the API with Axios
- Using number/text input field to set the data values in ChartJs stops the chart from being displayed
- Generate bar chart using chart.js and associative array
- How to start the chart from specific time and offest hour and then show the data on chart from target datetime in chartjs
- ChartJS - would like to create a mixed chart with horizontal Bar and a dot to represent the answer from the current user
- How do i have a single Chart.vue component instead of different chart components and then display charts from it by changing id of the API
- django + chart.js : Cannot get two bar charts on the same graph with appropriate data
- How to render multiple Chart.JS charts on the same page with AJAX data and variables
- I need a PHP query to grab data from the database and use in my bar charts for results
- Create a pie chart using an array from a data table in chart.js
- 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
- Accessing data from the callback function of a bar chart using chart js
- How to set the data of chart in angular which is taken from the backend nodejs api that is store in mongodb and showing on the html page
- Chart.js returns a console error and does not display the chart when using variables as data input
- Chart changes different on zoom when using multiple charts with chart.js and flask
- Charts with previous data appear when hovering the cursor over the chart in Chart.js
- Multiple axis line chart with Chart.js and JSON data from Google Sheet
More Query from same tag
- How to update chart when state changes in vue?
- How to add space between two scales in chart-js?
- Changing cursor to pointer on Chart.js bar chart when hover (mousemove) event is disabled?
- How to create a charjs bar graph with many bars?
- ChartJs - set background color of the space between ticks
- chart.js 3 stacked bar chart - tooltip showing for zero values
- How can i do this chart in react?
- Chart.js not initiating
- Syntax error : Cannot use import statement outside a module in Vue2 chart js
- Chart.js how to set cutoutPercentages for each dataset
- How to add labels into Chart.js canvas plugin?
- Dynamically updating time data in chart.js freezes the chart
- Dynamically add charts with chart.js
- How to make the chart smaller than its container
- Strange lines between horizontal bars in Chart.js 2.0
- Chartjs populate data with Axios response
- Django 1.11 - child template not inheriting from parent
- Add dynamic dataset to chart.js
- Chart Js doesn't update the values in the first load
- How to implement mysql database connection in Chart.js
- How to put an image a circle chart
- How to align bars in bar chart - Chart.js
- Problem creating chart out of GET request with Angular
- Chart.js click on labels, using bar chart
- Retrieve value returned from a function in Angular
- Chart.js bar chart bars and labels do not align
- Angular Radar Chart :OnClick event of label or sector
- Angular chartjs directive
- How can i launch a modal after clicking each bar in Bar chart in Chartjs and also how can i get its data?
- How to make gap in chart.js graph?