Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Jerome Cukier committed Aug 17, 2016
1 parent b1a9519 commit 2990418
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 23 deletions.
8 changes: 4 additions & 4 deletions src/App.js
Expand Up @@ -103,10 +103,10 @@ class App extends Component {
}}
>
<SmallChart
highlighted={highlighted}
highlightX={this.highlightX}
series={data.Pressure}
title='Pressure'
highlighted={highlighted}
highlightX={this.highlightX}
series={data.Pressure}
title='Pressure'
/>
<SmallChart
highlighted={highlighted}
Expand Down
14 changes: 6 additions & 8 deletions src/large-chart.js
Expand Up @@ -16,13 +16,11 @@ const DAY_IN_MS = 24 * HOUR_IN_MS;

const FlexibleXYPlot = makeWidthFlexible(XYPlot);

// import * as CONSTANTS from './constants.js';

export default class LargeChart extends Component {
render() {
const {highlighted, highlightX, series} = this.props;
const minValue = series.reduce((prev, curr) => Math.min(prev, curr.y), Infinity);
const maxValue = series.reduce((prev, curr) => Math.max(prev, curr.y), -Infinity);
const minValue = Math.min(...series.map(d => d.y));
const maxValue = Math.max(...series.map(d => d.y));

const yDomain = [0.98 * minValue, 1.02 * maxValue];
const tickValues = series.map(d => d.x);
Expand Down Expand Up @@ -60,24 +58,24 @@ export default class LargeChart extends Component {
stroke='#11939a'
strokeWidth={2}
/>
{highlighted === undefined ? null :
{highlighted ?
<LineSeries
data={[
{x: highlighted && highlighted.x, y: yDomain[0]},
{x: highlighted && highlighted.x, y: yDomain[1]}
]}
stroke='rgba(17,147,154,0.7)'
strokeWidth={2}
/>
/> : null
}
{highlighted === undefined ? null :
{highlighted ?
<MarkSeries
data={[{
x: highlighted && highlighted.x,
y: highlighted && series[highlighted.i].y
}]}
color='rgba(17,147,154,0.7)'
/>
/> : null
}
<XAxis
tickSize={4}
Expand Down
7 changes: 0 additions & 7 deletions src/logo.svg

This file was deleted.

2 changes: 1 addition & 1 deletion src/secrets.json
@@ -1,3 +1,3 @@
{
"API": "ENTER YOUR OPENWEATHERMAP API HERE"
"API": "ENTER YOUR API KEY HERE"
}
6 changes: 3 additions & 3 deletions src/small-chart.js
Expand Up @@ -20,9 +20,9 @@ export default class SmallChart extends Component {
if (!series) {
return <div />;
}
const minValue = series.reduce((prev, curr) => Math.min(prev, curr.y), Infinity);
const maxValue = series.reduce((prev, curr) => Math.max(prev, curr.y), -Infinity);

const minValue = Math.min(...series.map(d => d.y));
const maxValue = Math.max(...series.map(d => d.y));
const yDomain = [0.98 * minValue, 1.02 * maxValue];
const labelValues = makeLabelValues(series);

Expand Down

0 comments on commit 2990418

Please sign in to comment.