Skip to content

Commit

Permalink
pretty number format in chart y-axes
Browse files Browse the repository at this point in the history
  • Loading branch information
dannyvankooten committed Nov 23, 2018
1 parent a8e2989 commit f5cd87f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions assets/src/js/components/Chart.js
Expand Up @@ -3,7 +3,7 @@
import { h, Component } from 'preact';
import Client from '../lib/client.js';
import { bind } from 'decko';

import * as numbers from '../lib/numbers.js';
import * as d3 from 'd3';
import 'd3-transition';
d3.tip = require('d3-tip');
Expand Down Expand Up @@ -181,7 +181,7 @@ class Chart extends Component {
const max = d3.max(data, d => d.Pageviews);
let x = this.x.domain(data.map(d => d.Date))
let y = this.y.domain([0, max*1.1])
let yAxis = d3.axisLeft().scale(y).ticks(3).tickSize(-innerWidth)
let yAxis = d3.axisLeft().scale(y).ticks(3).tickSize(-innerWidth).tickFormat((v, i) => numbers.formatPretty(v))
let xAxis = d3.axisBottom().scale(x).tickFormat(timeFormatPicker(data.length, this.state.diffInDays))

// hide all "day" ticks if we're watching more than 31 items of data
Expand Down

0 comments on commit f5cd87f

Please sign in to comment.