You need to sign in to do that
Don't have an account?
vinod fnu
how pass data from a wire to chartjs
@wire(AggregateResult) AggregateResult({error,data}){
if (data) {
this.data = data;
this.error = undefined;
} else if (error) {
this.error = error;
this.data = undefined;
}}
chart;
config2 = {
type: 'bar',
data: {
labels: ['January', 'Feburary', 'March', 'April', 'May', 'June','July','August','September','October','November','December'],
datasets: [{
label: '# of Trust',
data: [19, 19, 3, 5, 2, 3,34,66,77,65,34,44],
///i want to replace the data with the values from the @wire.
data: this.data.expr0,
),
on the html
<template if:true={data}>
Page
<template for:each={data} for:item="ent">
<p key={ent.id}>{ent.expr1}</p>
<p key={ent.id}>{ent.expr0}</p>
</template>
</template>
the out put is.
PagePage
27
13
23
42
19
39
22
23
29
32
88
110
Just want to put these values in the chart data.
if (data) {
this.data = data;
this.error = undefined;
} else if (error) {
this.error = error;
this.data = undefined;
}}
chart;
config2 = {
type: 'bar',
data: {
labels: ['January', 'Feburary', 'March', 'April', 'May', 'June','July','August','September','October','November','December'],
datasets: [{
label: '# of Trust',
data: [19, 19, 3, 5, 2, 3,34,66,77,65,34,44],
///i want to replace the data with the values from the @wire.
data: this.data.expr0,
),
on the html
<template if:true={data}>
Page
<template for:each={data} for:item="ent">
<p key={ent.id}>{ent.expr1}</p>
<p key={ent.id}>{ent.expr0}</p>
</template>
</template>
the out put is.
PagePage
27
13
23
42
19
39
22
23
29
32
88
110
Just want to put these values in the chart data.
Does the code snippet in the answer of https://salesforce.stackexchange.com/questions/307320/chart-with-dynamic-data-lwc?rq=1 help?