Giter VIP home page Giter VIP logo

Comments (6)

larssont avatar larssont commented on September 13, 2024 2

There is a way to change the fonts, but it's a bit complicated and cumbersome if you have multiple charts.
It would be great if we could update the defaults of all charts, the same you would when interacting with the Chart.js library directly.

More or less like this:

Chart.defaults.color = "#dcddde";
Chart.defaults.borderColor = "#444";
Chart.defaults.maintainAspectRatio = false;
Chart.defaults.elements.bar.borderWidth = 1;
Chart.defaults.elements.bar.hoverBorderWidth = 2;
Chart.defaults.plugins.title.display = true;
Chart.defaults.plugins.title.font = { weight: "normal", size: 20 };

This would make it so much easier to use charts through Dataview scripts. Perhaps introducing more plugin settings for defaults would be a decent way to accomplish it? Or at least exposing the options programmatically.

from obsidian-charts.

larssont avatar larssont commented on September 13, 2024 2

There is a way to change the fonts, but it's a bit complicated and cumbersome if you have multiple charts. It would be great if we could update the defaults of all charts, the same you would when interacting with the Chart.js library directly.
More or less like this:

Chart.defaults.color = "#dcddde";
Chart.defaults.borderColor = "#444";
Chart.defaults.maintainAspectRatio = false;
Chart.defaults.elements.bar.borderWidth = 1;
Chart.defaults.elements.bar.hoverBorderWidth = 2;
Chart.defaults.plugins.title.display = true;
Chart.defaults.plugins.title.font = { weight: "normal", size: 20 };

This would make it so much easier to use charts through Dataview scripts. Perhaps introducing more plugin settings for defaults would be a decent way to accomplish it? Or at least exposing the options programmatically.

Hi larssont, could you please share where to insert the code to make it work?

Those were simply suggestions on how I would want the configuration to work for obsidian-charts, but it is not possible to configure the fonts in that manner exactly (unless something has changed since last time I looked into this).

from obsidian-charts.

sector101010 avatar sector101010 commented on September 13, 2024

I found you can set the font like this - you need to also set the 'family', otherwise it won't take hold:

                scales: {
                    x: {
                        ticks: {
                            font: {
                                size: 30,
                                family:'Arial',
                            }
                        }
                    },
                    y: {
                        ticks: {
                            font: {
                                size: 30,
                                family: 'Arial',
                            }
                        }
                    }
                }

from obsidian-charts.

adamstorkbm avatar adamstorkbm commented on September 13, 2024

I found you can set the font like this - you need to also set the 'family', otherwise it won't take hold:

                scales: {
                    x: {
                        ticks: {
                            font: {
                                size: 30,
                                family:'Arial',
                            }
                        }
                    },
                    y: {
                        ticks: {
                            font: {
                                size: 30,
                                family: 'Arial',
                            }
                        }
                    }
                }

Hi sector101010, could you please share where to insert the code to make it work?

from obsidian-charts.

adamstorkbm avatar adamstorkbm commented on September 13, 2024

There is a way to change the fonts, but it's a bit complicated and cumbersome if you have multiple charts. It would be great if we could update the defaults of all charts, the same you would when interacting with the Chart.js library directly.

More or less like this:

Chart.defaults.color = "#dcddde";
Chart.defaults.borderColor = "#444";
Chart.defaults.maintainAspectRatio = false;
Chart.defaults.elements.bar.borderWidth = 1;
Chart.defaults.elements.bar.hoverBorderWidth = 2;
Chart.defaults.plugins.title.display = true;
Chart.defaults.plugins.title.font = { weight: "normal", size: 20 };

This would make it so much easier to use charts through Dataview scripts. Perhaps introducing more plugin settings for defaults would be a decent way to accomplish it? Or at least exposing the options programmatically.

Hi larssont, could you please share where to insert the code to make it work?

from obsidian-charts.

adamstorkbm avatar adamstorkbm commented on September 13, 2024

I see, thanks for your reply.

from obsidian-charts.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.