Pls, Help me
I Want create expressions quick chart, but error like this
My expressions :
CONCATENATE(
"https://quickchart.io/chart?c=
{ type: 'bar',
data: { datasets:
[ { data: [",[PROGRESS (PLAN)]* 100,",",[PROGRESS (PLAN)]* 100,",",[DEVIASI]* 100,"], backgroundColor: [ 'rgb(255, 99, 132)', 'rgb(255, 159, 64)', 'rgb(255, 205, 86)', ],
label: 'Plan VS Actual', }, ],
labels: ['Plan', 'Actual', 'Deviasi'],},
options: {
plugins: {
datalabels: {
anchor: 'end',
align: 'top',
color: '#fff',
backgroundColor: 'rgba(34, 139, 34, 0.6)',
borderColor: 'rgba(34, 139, 34, 1.0)',
borderWidth: 1,
borderRadius: 5,
formatter: (value) => {
return value + 'k';
}
}
}
}
}
")
The issue seems to be related to incorrect string formatting in your CONCATENATE expression for QuickChart. JSON strings require proper escaping, especially when used in URLs. Here's a corrected version of your formula with properly escaped characters:
CONCATENATE(
"https://quickchart.io/chart?c=",
"{",
"type: 'bar',",
"data: {",
"datasets: [",
"{",
"data: [", [PROGRESS (PLAN)] * 100, ",", [PROGRESS (PLAN)] * 100, ",", [DEVIASI] * 100, "],",
"backgroundColor: [ 'rgb(255, 99, 132)', 'rgb(255, 159, 64)', 'rgb(255, 205, 86)' ],",
"label: 'Plan VS Actual'",
"}",
"],",
"labels: ['Plan', 'Actual', 'Deviasi']",
"},",
"options: {",
"plugins: {",
"datalabels: {",
"anchor: 'end',",
"align: 'top',",
"color: '#fff',",
"backgroundColor: 'rgba(34, 139, 34, 0.6)',",
"borderColor: 'rgba(34, 139, 34, 1.0)',",
"borderWidth: 1,",
"borderRadius: 5,",
"formatter: (value) => { return value + 'k'; }",
"}",
"}",
"}",
"}"
)
Key Changes:
1. Proper Escaping: JSON strings must be properly escaped for use in URLs. Ensure you escape any special characters like quotes (') and spaces.
2. CONCATENATE Format: Separate each line and ensure concatenation is continuous.
Debugging Tips:
Use a JSON validator to confirm that the JSON inside the URL is valid.
If the issue persists, test the generated URL in your browser to pinpoint formatting problems.
User | Count |
---|---|
28 | |
14 | |
3 | |
3 | |
3 |