• Resolved kevinkrit

    (@kevinkrit)


    Hi! Thank you for this awesome plugin! Quick question:

    Is there a way to change the background of the generated images?

    I changed the text of my charts to white because I run my page on a dark theme, which makes the charts themselves look great but not the generated images because they have a white background. Any way to change that?

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author methnen

    (@methnen)

    Changing the Chart.js background is actually a bit complicated currently.

    Basically what you need to do is a draw a box in the canvas object via a custom Chart.js plugin.

    You can see this illustrated in the Chart.js docs:

    https://www.chartjs.org/docs/latest/configuration/canvas-background.html

    I have some longer term plans to abstract it a bit so that themes can set the background color in a simple manner. I can’t say when that would happen though as my real job takes precedence of course. ??

    I can verify that it’s doable though as I’ve had some paid customizations I worked on that set background colors and customized the visuals in even more specific ways but it currently requires a custom plugin that hooks into some of the M Chart action/filter hooks spelled out in the docs here:

    https://github.com/methnen/m-chart/wiki/Action-and-filter-hooks

    Thread Starter kevinkrit

    (@kevinkrit)

    Appreciate the quick reply! I’ll look into custom plugins and hooks and see if it’s worth messing around with as my issue is very minor.

    Thanks again for the plugin and quick help.

    Have a great day!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Change background of generated images’ is closed to new replies.