below I send example of candlestick charts.js date structure - (JSON type):
<script>
const data1 = luxon.DateTime.fromRFC2822('15 Dec 2021 00:00 GMT');
const date2 = luxon.DateTime.fromRFC2822('16 Dec 2021 00:00 GMT');
const data = {
datasets: [{
data: [
{
x: data1.valueOf(),
o: 1,
h: 0.75,
l: 0.75,
c: 1.25
},
{
x: date2.valueOf(),
o: 1.20,
h: 1.5,
l: 0.75,
c: 0.9
}
],
}]
};
// config
const config = {
type: 'candlestick',
data,
options: {}
};
// render init block
const myChart = new Chart(
document.getElementById('myChart'),
config
);
</script>
It seems similar to serializers? So I wonder if it is possible to send it in context to make this json like data
And seems...
const data = {{data}}