-
Notifications
You must be signed in to change notification settings - Fork 69
Applying callback functions #32
Comments
I just found out the answer myself . For those who are struggling with this. import JsExpression. :-)
|
@adummy832 sorry for the delay. I was about to write that and you were faster :) The Thank you for your time @adummy832 very kind of you to expose your findings. |
Still thanks for the reply the dude, you are awesome! Been stuck on this for hours XD. Are there still some hidden 'Class' treasure in Yii like this one? If so, could you recommend that so that I can check that out? BTW, thanks for this awesome plug-in dude. Godspeed! :-) |
Yii is full of goodies... I highly recommend you to read its base classes code (don't forget its classes). I always do that with every framework I work with. Best way to get the hidden wonders of other people's brains. |
Yii is full of goodies... I highly recommend you to read its base classes code (don't forget its HELPER classes) |
How you use it? options: {
scales: {
yAxes: [{
ticks: {
callback: function (value) {
return numeral(value).format('$ 0,0')
}
}
}]
}
} And this is my code in PHP: echo ChartJs::widget(
[
'type' => 'bar',
'options' => [
'height' => 600,
'width' => 1400,
'scales' => [
'yAxes' => new JsExpression(
"
[{
ticks: {
callback: function (value) {
return numeral(value).format('$ 0,0')
}
}
}]
"
)
],
],
'data' => [
'labels' => $arrayChart['label'],
'datasets' => [
[
'label' => 'Total Pendapatan',
'backgroundColor' => '#38a9ff',
'data' => $arrayChart['isi'],
],
],
],
]
); It doesn't work, the number is still not formatted, and I don't know the right way to do it. edit: <canvas id="w0"
width="1222"
height="523"
scales="{"yAxes":
[{
ticks: {
callback: function (value) {
return numeral(value).format(" $="" 0,0')="" }="" }]="" }'=""
style="display: block; width: 1222px; height: 523px;"
class="chartjs-render-monitor"></canvas> |
This works for me! I was trying to change the tooltips content |
I have this bar chart, just a standard one and I want to modify how yAxes labels are showing without decimals, however I have this weird thing going on. Here's my config options. Can you explain why is this happening & what is the possible workaround for this? Thank you.
The text was updated successfully, but these errors were encountered: