chartjs-php icon indicating copy to clipboard operation
chartjs-php copied to clipboard

JS expressions should be encoded as is or omitted?

Open xcopy opened this issue 5 months ago • 0 comments

Example:

$options = new Options();
$options->plugins = [
    'tooltip' => [
        'enabled' => true,
        'callbacks' => [
            'label' => "function (context) {...}"
        ]
    ]
];

Expected result:

new Chart(ctx,{
    type: "...",
    data: {
        // ...
    },
    options: {
        // ...
        plugins: {
            tooltip: {
                enabled: true,
                callbacks: {
                    label: function (context) {
                        // ...
                    }
                }
            }
        }
    }
})

Actual result:

new Chart(ctx,{
    type: "...",
    data: {
        // ...
    },
    options: {
        // ...
        plugins: {
            tooltip: {
                enabled: true,
                callbacks: {
                    label: "function (context) {\n
                        // ...
                    \n}"
                }
            }
        }
    }
})

xcopy avatar Jul 10 '25 09:07 xcopy