IridiumIO / pyChart.js

Objective Chart.js implementation for Python and Django
MIT License
122 stars 6 forks source link

Class is not JSON Serializable #3

Open keithii opened 10 months ago

keithii commented 10 months ago

In creating an example similar to the multi-line chart at the end of the Readme, the settings in class option need to be moved to class pluginOptions to work with updates to chart.js. However, an error occurs that the classes (e.g., class Title) are not serializable.

The correction seems to be the need to add 'General' as the second argument of ChartUtils.cleanClass on line 72 of pychartjs.py under 'def getPluginOptions'

Iridium-IO commented 10 months ago

Which version of chart.js are you using? I'll admit I haven't checked the compatibility in a while.

keithii commented 10 months ago

I meant to go back in and update my note. It looks like the interface changed for v3.

On Thu, Jan 4, 2024 at 10:54 AM Iridium IO @.***> wrote:

Which version of chart.js are you using? I'll admit I haven't checked the compatibility in a while.

— Reply to this email directly, view it on GitHub https://github.com/IridiumIO/pyChart.js/issues/3#issuecomment-1877441309, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASRI5NWVKNRCRRNE6U2A633YM3NEFAVCNFSM6AAAAABBM4OOP2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZXGQ2DCMZQHE . You are receiving this because you authored the thread.Message ID: @.***>

Iridium-IO commented 10 months ago

Weird, I last tested it for 3.9.1 and I'm pretty sure it worked fine then. I'll have another look, I might not have checked the multiline :)

keithii commented 10 months ago

I appreciate that. When I look at the return for your example, there is an error for yScales. I didn’t try for very long to fix that. The only thing I really messed with was the title, which I had to move to PluginOptions, then make that change to the getPluginOptions and add General to the method call. The legend is also still sitting above even though the position says bottom.

On Thu, Jan 4, 2024 at 4:47 PM Iridium IO @.***> wrote:

Weird, I last tested it for 3.9.1 and I'm pretty sure it worked fine then. I'll have another look, I might not have checked the multiline :)

— Reply to this email directly, view it on GitHub https://github.com/IridiumIO/pyChart.js/issues/3#issuecomment-1877864748, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASRI5NRJLGUMDPD4UBN3KLDYM4WR7AVCNFSM6AAAAABBM4OOP2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZXHA3DINZUHA . You are receiving this because you authored the thread.Message ID: @.***>

keithii commented 10 months ago

Looks like to fix the legend location, "Bottom" needs to be "bottom" and the error being received back from chart.js regarding invalid scale configuration was due to the [] around _yScales.