Skip to content

Commit

Permalink
Adds LineChart example
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcos Iglesias committed Nov 24, 2020
1 parent b2c781b commit 9869cfe
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,28 @@ import './App.css';

import DonutChartImport from './donut/DonutChartImport';
import DonutChartCommonJS from './donut/DonutChartCommonJS';

import DonutChartLibESM from './donut/DonutChartLibESM';
import DonutChartLibCJS from './donut/DonutChartLibCJS';
import DonutChartLibUMD from './donut/DonutChartLibUMD';

import LineChartImport from './line/LineChartImport';

class App extends Component {
render() {
return (
<div className="App">
<header className="App-header">
<img src={britechartsLogo} className="brc-logo" alt="Britecharts-React logo" />
<img
src={britechartsLogo}
className="brc-logo"
alt="Britecharts-React logo"
/>
<img src={reactLogo} className="react-logo" alt="logo" />
<h1 className="App-title">Welcome to the Britecharts-React demo project!</h1>
<h1 className="App-title">
Welcome to the Britecharts-React demo project!
</h1>
</header>
<h2>Donut Chart</h2>
<div className="chart-container">
<h3>Loading with ES2015 imports from dist/</h3>
<DonutChartImport />
Expand All @@ -39,6 +47,11 @@ class App extends Component {
<h3>Loading with UMD from lib/</h3>
<DonutChartLibUMD />
</div>
<h2>Line Chart</h2>
<div className="chart-container">
<h3>Loading with ES2015 imports from dist</h3>
<LineChartImport />
</div>
</div>
);
}
Expand Down
9 changes: 9 additions & 0 deletions src/line/LineChartImport.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from "react";
import { withTwoTopics } from "./data";
import { Line, axisTimeCombinations } from "britecharts-react";

const LineChartImport = () => (
<Line data={withTwoTopics()} xAxisFormat={axisTimeCombinations.MINUTE_HOUR} />
);

export default LineChartImport;
28 changes: 28 additions & 0 deletions src/line/data.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
export const withTwoTopics = () => ({
data: [
{
topicName: "San Francisco",
name: 1,
date: "2017-01-16T16:00:00-08:00",
value: 1,
},
{
topicName: "San Francisco",
name: 1,
date: "2017-01-17T16:00:00-08:00",
value: 2,
},
{
topicName: "Oakland",
name: 2,
date: "2017-01-16T16:00:00-08:00",
value: 3,
},
{
topicName: "Oakland",
name: 2,
date: "2017-01-17T16:00:00-08:00",
value: 7,
}
],
});

0 comments on commit 9869cfe

Please sign in to comment.