question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to change values format

See original GitHub issue

Expected Behavior

allow to change values format

Actual Behavior

I’m trying to change a Pie chart values format to currency, but after I add the scales option it throws an error:

screen shot 2018-03-01 at 10 18 09

and this is the code:

import { Pie, mixins } from 'vue-chartjs'
// import { toCurrency } from 'utils/formatter.util'

const { reactiveProp } = mixins

export default {
  extends: Pie,
  mixins: [reactiveProp],
  props: ['options'],
  mounted () {
    // Overwriting base render method with actual data.
    this.renderChart(this.chartData, {
      responsive: false,
      maintainAspectRatio: false,
      legend: {
        display: false
      },
      scales: {
        yAxes: [{
          ticks: {
            callback: function (value, index, values) {
              console.log(value, index, values)
              return '' + value
            }
          }
        }]
      }
    })
  }

Environment

  • vue.js version: 2.5.2
  • vue-chart.js version: 3.2.1
  • npm version: 5.6.0

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
aperturelesscommented, Mar 6, 2018

https://codepen.io/apertureless/pen/LQKmYN?

Oh sorry, did not saw that you are talking about the Pie chart. Well the Pie and Doughnut Charts do not have Y / X Scales. So there is no reason to pass in the scales object. So what you’re trying to do is change to tooltip right?

Then you have only to pass in the tooltip object.

0reactions
aperturelesscommented, Mar 6, 2018

@oswaldofreitas Well its not in the docs per se, but it’s kind of clear that the doughnut and pie charts, do not have X / Y axis. As their data is neigher linear nor logarithmic nor time based.

So there is no X or Y scale to style there.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Change numbers with text format to number format in Excel for ...
Change numbers with text format to number format in Excel for the web · Select the cells that have the data you want...
Read more >
Number Formatting in Excel: Step-by-Step Tutorial (2022)
1. Select the cell to format. 2. Go to Home > Number. 3. From the menu, go to More Number Formats. 4. Go...
Read more >
How to change the format of numeric values - Trifacta
In the top Search box, enter 'Numformat' and search. Select the resulting NUMFORMAT option. This transform converts the value you provide to a...
Read more >
How to change Excel date format and create custom formatting
Select the cell with a date in Excel, press Ctrl+1 to open the Format Cells window and switch to the General tab. If...
Read more >
7 Amazing Excel Custom Number Format Tricks (you Must ...
With custom number formatting in Excel, you can change the way the values in the cells show up, but at the same time...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found