|
1 | 1 | import * as React from 'react';
|
2 | 2 | import * as Utilities from '@common/utilities';
|
3 | 3 |
|
| 4 | +import BarGraphWithLines from '@system/graphs/BarGraphWithLines'; |
4 | 5 | import ChartLegend from '@system/graphs/ChartLegend';
|
5 | 6 | import ColumnChart from '@system/graphs/ColumnChart';
|
6 | 7 | import DemoSystemDataVisualizationSidebar, { VISUALIZATION_OPTIONS } from '@demos/DemoSystemDataVisualizationSidebar';
|
@@ -28,6 +29,99 @@ const EXAMPLE_DUMMY_DATA = [
|
28 | 29 |
|
29 | 30 | const EXAMPLE_LEGEND_DATA = [`var(--theme-graph-positive)`, `var(--theme-graph-negative)`];
|
30 | 31 |
|
| 32 | +const EXAMPLE_BAR_GRAPH_WITH_LINES_DATA = [ |
| 33 | + { |
| 34 | + year: '2005', |
| 35 | + years: [ |
| 36 | + { name: 'electronics', value: 120, color: 'var(--theme-graph-positive)' }, |
| 37 | + { name: 'clothing', value: 150, color: 'var(--theme-success)' }, |
| 38 | + { name: 'accessories', value: 30, color: 'var(--theme-primary)' }, |
| 39 | + ], |
| 40 | + }, |
| 41 | + { |
| 42 | + year: '2006', |
| 43 | + years: [ |
| 44 | + { name: 'electronics', value: 115, color: 'var(--theme-graph-positive)' }, |
| 45 | + { name: 'clothing', value: 165, color: 'var(--theme-success)' }, |
| 46 | + { name: 'accessories', value: 45, color: 'var(--theme-primary)' }, |
| 47 | + ], |
| 48 | + }, |
| 49 | + { |
| 50 | + year: '2007', |
| 51 | + years: [ |
| 52 | + { name: 'electronics', value: 130, color: 'var(--theme-graph-positive)' }, |
| 53 | + { name: 'clothing', value: 175, color: 'var(--theme-success)' }, |
| 54 | + { name: 'accessories', value: 55, color: 'var(--theme-primary)' }, |
| 55 | + ], |
| 56 | + }, |
| 57 | + { |
| 58 | + year: '2008', |
| 59 | + years: [ |
| 60 | + { name: 'electronics', value: 125, color: 'var(--theme-graph-positive)' }, |
| 61 | + { name: 'clothing', value: 190, color: 'var(--theme-success)' }, |
| 62 | + { name: 'accessories', value: 60, color: 'var(--theme-primary)' }, |
| 63 | + ], |
| 64 | + }, |
| 65 | + { |
| 66 | + year: '2009', |
| 67 | + years: [ |
| 68 | + { name: 'electronics', value: 140, color: 'var(--theme-graph-positive)' }, |
| 69 | + { name: 'clothing', value: 185, color: 'var(--theme-success)' }, |
| 70 | + { name: 'accessories', value: 65, color: 'var(--theme-primary)' }, |
| 71 | + ], |
| 72 | + }, |
| 73 | + { |
| 74 | + year: '2010', |
| 75 | + years: [ |
| 76 | + { name: 'electronics', value: 150, color: 'var(--theme-graph-positive)' }, |
| 77 | + { name: 'clothing', value: 210, color: 'var(--theme-success)' }, |
| 78 | + { name: 'accessories', value: 70, color: 'var(--theme-primary)' }, |
| 79 | + ], |
| 80 | + }, |
| 81 | + { |
| 82 | + year: '2011', |
| 83 | + years: [ |
| 84 | + { name: 'electronics', value: 155, color: 'var(--theme-graph-positive)' }, |
| 85 | + { name: 'clothing', value: 220, color: 'var(--theme-success)' }, |
| 86 | + { name: 'accessories', value: 75, color: 'var(--theme-primary)' }, |
| 87 | + ], |
| 88 | + }, |
| 89 | + { |
| 90 | + year: '2012', |
| 91 | + years: [ |
| 92 | + { name: 'electronics', value: 160, color: 'var(--theme-graph-positive)' }, |
| 93 | + { name: 'clothing', value: 230, color: 'var(--theme-success)' }, |
| 94 | + { name: 'accessories', value: 85, color: 'var(--theme-primary)' }, |
| 95 | + ], |
| 96 | + }, |
| 97 | + { |
| 98 | + year: '2013', |
| 99 | + years: [ |
| 100 | + { name: 'electronics', value: 165, color: 'var(--theme-graph-positive)' }, |
| 101 | + { name: 'clothing', value: 240, color: 'var(--theme-success)' }, |
| 102 | + { name: 'accessories', value: 90, color: 'var(--theme-primary)' }, |
| 103 | + ], |
| 104 | + }, |
| 105 | + { |
| 106 | + year: '2014', |
| 107 | + years: [ |
| 108 | + { name: 'electronics', value: 170, color: 'var(--theme-graph-positive)' }, |
| 109 | + { name: 'clothing', value: 250, color: 'var(--theme-success)' }, |
| 110 | + { name: 'accessories', value: 95, color: 'var(--theme-primary)' }, |
| 111 | + ], |
| 112 | + }, |
| 113 | + { |
| 114 | + year: '2015', |
| 115 | + years: [ |
| 116 | + { name: 'electronics', value: 180, color: 'var(--theme-graph-positive)' }, |
| 117 | + { name: 'clothing', value: 260, color: 'var(--theme-success)' }, |
| 118 | + { name: 'accessories', value: 100, color: 'var(--theme-primary)' }, |
| 119 | + ], |
| 120 | + }, |
| 121 | +]; |
| 122 | + |
| 123 | +const EXAMPLE_BAR_GRAPH_WITH_LINES_DATA_LEGEND = [`var(--theme-graph-positive)`, `var(--theme-success)`, `var(--theme-primary)`]; |
| 124 | + |
31 | 125 | function ExampleSystemDataVisualizationColumn(props) {
|
32 | 126 | // TODO(jimmylee)
|
33 | 127 | // Refactor these.
|
@@ -59,6 +153,15 @@ function ExampleSystemDataVisualizationColumn(props) {
|
59 | 153 | <ColumnChart data={EXAMPLE_DUMMY_DATA} />
|
60 | 154 | <ChartLegend data={EXAMPLE_LEGEND_DATA} />
|
61 | 155 | </div>
|
| 156 | + |
| 157 | + <div style={infoStyles}> |
| 158 | + <Title>Example B</Title> |
| 159 | + <Text style={{ marginTop: `12px` }}>This is an example of a React & D3 circle and line bar chart component that you can use.</Text> |
| 160 | + </div> |
| 161 | + <div style={chartContainerStyles}> |
| 162 | + <BarGraphWithLines data={EXAMPLE_BAR_GRAPH_WITH_LINES_DATA} /> |
| 163 | + <ChartLegend data={EXAMPLE_BAR_GRAPH_WITH_LINES_DATA_LEGEND} /> |
| 164 | + </div> |
62 | 165 | </TwoColumnLayoutFull>
|
63 | 166 | <GlobalModalManager />
|
64 | 167 | </Page>
|
|
0 commit comments