Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to set font file (foo.ttf) #61

Open
katsube opened this issue Aug 6, 2018 · 1 comment
Open

How to set font file (foo.ttf) #61

katsube opened this issue Aug 6, 2018 · 1 comment

Comments

@katsube
Copy link

katsube commented Aug 6, 2018

Hi, everyone.
Thank you for the wonderful library.

If Japanese language is set as the label, it will not be output to the graph image.

const chartJsOptions = {
    type: 'line',
    data: {
        labels: ['8/1','8/2','8/3'],
        datasets: [{
                label: "チャート",   // Here!
                borderColor: 'rgb(255, 0, 0)',
                data: [20, 26, 12]
        }]
    }
}

Is there a way to set a font file(foo.ttf) or solve this?

environment

  • macOS 10.13.6
  • Node.js v10.1.0
  • chart.js 2.7.2
  • chartjs-node 1.7.1
  • cairo stable 1.14.12

Thanks.

@katsube
Copy link
Author

katsube commented Aug 6, 2018

Sorry, I forgot to upload the result.

const chartJsOptions = {
    type: 'line',
    data: {
        labels: ['8/1','8/2','8/3'],
        datasets: [{
            label: "チャート",
            borderColor: 'rgb(255, 0, 0)',
            data: [20, 26, 12]
        },
        {
            label: "Chart",
            borderColor: 'rgb(0, 255, 0)',
            data: [10, 12, 30]
        }]
    }
};

testimage

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant