From ac87752c2e15a7cd1336e7c2dee96760ac47a67a Mon Sep 17 00:00:00 2001 From: Harry Shoff Date: Thu, 29 Jun 2017 22:12:43 -0700 Subject: [PATCH] [axis] export orientation constants --- packages/vx-axis/src/index.js | 1 + packages/vx-axis/test/Orientation.test.js | 19 ++ packages/vx-demo/components/gallery.js | 24 +- packages/vx-demo/components/tiles/legends.js | 199 ++++++++------- packages/vx-demo/components/tiles/voronoi.js | 25 +- packages/vx-demo/pages/legends.js | 247 ++++++++++--------- 6 files changed, 283 insertions(+), 232 deletions(-) create mode 100644 packages/vx-axis/test/Orientation.test.js diff --git a/packages/vx-axis/src/index.js b/packages/vx-axis/src/index.js index 6af30f02f..837ff5d15 100644 --- a/packages/vx-axis/src/index.js +++ b/packages/vx-axis/src/index.js @@ -3,3 +3,4 @@ export { default as AxisLeft } from './axis/AxisLeft'; export { default as AxisRight } from './axis/AxisRight'; export { default as AxisTop } from './axis/AxisTop'; export { default as AxisBottom } from './axis/AxisBottom'; +export { default as Orientation } from './constants/orientation'; diff --git a/packages/vx-axis/test/Orientation.test.js b/packages/vx-axis/test/Orientation.test.js new file mode 100644 index 000000000..3e5aaba53 --- /dev/null +++ b/packages/vx-axis/test/Orientation.test.js @@ -0,0 +1,19 @@ +import { Orientation } from '../src'; + +describe('Orientation', () => { + test('it should be defined', () => { + expect(Orientation).toBeDefined(); + }); + test('top should be defined', () => { + expect(Orientation.top).toBeDefined(); + }); + test('left should be defined', () => { + expect(Orientation.left).toBeDefined(); + }); + test('right should be defined', () => { + expect(Orientation.right).toBeDefined(); + }); + test('bottom should be defined', () => { + expect(Orientation.bottom).toBeDefined(); + }); +}); diff --git a/packages/vx-demo/components/gallery.js b/packages/vx-demo/components/gallery.js index 1c2573525..005960f69 100644 --- a/packages/vx-demo/components/gallery.js +++ b/packages/vx-demo/components/gallery.js @@ -448,13 +448,13 @@ export default class Gallery extends React.Component {
this.nodes.add(d)} >
-
+
Legends
{``}
@@ -463,22 +463,22 @@ export default class Gallery extends React.Component {
- +
this.nodes.add(d)} > -
- +
+
-
+
Voronoi
{` `}
diff --git a/packages/vx-demo/components/tiles/legends.js b/packages/vx-demo/components/tiles/legends.js index bafc81fb7..1da20d118 100644 --- a/packages/vx-demo/components/tiles/legends.js +++ b/packages/vx-demo/components/tiles/legends.js @@ -20,17 +20,22 @@ const twoDecimalFormat = format('.2f'); const quantile = scaleQuantize({ domain: [0, 0.15], - range: ['#fdd0a2', '#fdae6b', '#fd8d3c', '#f16913', '#d94801'], + range: ['#eb4d70', '#f19938', '#6ce18b', '#78f6ef', '#9096f8'], }); const linear = scaleLinear({ domain: [0, 10], - range: ['#0068af', '#c00029'], + range: ['#ed4fbb', '#e9a039'], }); const ordinalColor = scaleOrdinal({ domain: ['a', 'b', 'c', 'd'], - range: ['#160689', '#a72297', '#f68e44', '#f8e126'].reverse(), + range: ['#7d81f6', '#4899f1', '#71f5ef', '#66d981'].reverse(), +}); + +const ordinalColor2 = scaleOrdinal({ + domain: ['a', 'b', 'c', 'd'], + range: ['#8386f7', '#e64357', '#f29b38', '#fae856'].reverse(), }); const ordinalShape = scaleOrdinal({ @@ -84,6 +89,11 @@ const sizeOpacity = scaleLinear({ range: [0.4, 1], }); +const sizeColor = scaleLinear({ + domain: [0, 10], + range: ['#75fcfc', '#3236b8'], +}); + function LegendDemo({ title, children }) { return (
@@ -92,16 +102,14 @@ function LegendDemo({ title, children }) {