Skip to content

Commit

Permalink
#315 nicer scale for chart
Browse files Browse the repository at this point in the history
  • Loading branch information
prayerslayer committed Oct 28, 2015
1 parent 743bc24 commit 4b9f984
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
import Icon from 'react-fa';
import moment from 'moment';
import _ from 'lodash';
import d3 from 'd3';
import Charts from 'react-d3-components';
import AutoWidth from '@zalando/react-automatic-width';
import Table from 'fixed-data-table';
Expand Down Expand Up @@ -63,6 +64,8 @@ class ViolationAnalysis extends React.Component {
quantity: c.quantity
}));
chartData = violationCount.filter(c => c.account === searchParams.inspectedAccount);
let maxQuantity = chartData.reduce((prev, cur) => prev > cur.quantity ? prev : cur.quantity, 0),
yScale = d3.scale.linear().domain([0, maxQuantity]).range([225, 0]).nice();

return <div className='violation-analysis'>
{chartData.length ?
Expand All @@ -79,6 +82,7 @@ class ViolationAnalysis extends React.Component {
tooltipMode='element'
height={300}
margin={{top: 50, left: 50, right: 25, bottom: 25}}
yScale={yScale}
yAxis={{label: '# Violations', innerTickSize: -1000}} />
</AutoWidth>
:
Expand Down

0 comments on commit 4b9f984

Please sign in to comment.