Skip to content
This repository has been archived by the owner on Jan 16, 2018. It is now read-only.

Commit

Permalink
Merge 90cbc89 into 89352d6
Browse files Browse the repository at this point in the history
  • Loading branch information
julien committed Dec 20, 2017
2 parents 89352d6 + 90cbc89 commit 0a6542d
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 15 deletions.
6 changes: 4 additions & 2 deletions packages/clay-charts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@
"scripts": {
"build": "npm run soy && webpack",
"compile": "babel -d lib/ src/ -s --ignore src/__tests__",
"prepublish": "npm run soy && npm run sass && npm run compile",
"prepublish": "npm run soy && npm run sass && npm run compile && npm run copyAssets",
"sass": "node-sass src/scss/main.scss -o lib/css --source-map true",
"soy": "metalsoy --soyDeps node_modules/metal*/src/**/*.soy node_modules/clay*/src/**/*.soy"
"soy": "metalsoy --soyDeps node_modules/metal*/src/**/*.soy node_modules/clay*/src/**/*.soy",
"copyAssets": "ncp src/svg lib/svg"
},
"keywords": [
"metal"
Expand Down Expand Up @@ -52,6 +53,7 @@
"css-loader": "^0.28.4",
"extract-text-webpack-plugin": "^3.0.1",
"metal-tools-soy": "^4.2.1",
"ncp": "^2.0.0",
"node-sass": "^4.5.3",
"sass-loader": "^6.0.6",
"style-loader": "^0.18.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/clay-charts/src/Chart.soy
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{namespace Chart}
{namespace ClayChart}

/**
* This renders the component's whole content.
Expand Down
15 changes: 15 additions & 0 deletions packages/clay-charts/src/ChartBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,18 @@ const DEFAULT_TILES = [
'vertical-small',
];

const DEFAULT_POINT_PATTERNS = [
'circle',
'rectangle',
'<polygon points="2.5 0 0 5 5 5"></polygon>',
'<polygon points="2.5 0 0 2.5 2.5 5 5 2.5"></polygon>',
'<polygon points="0 0 2.5 5 5 0"></polygon>',
'<path d="M5,5 a1,1 0 1,1 5,0">',
'<path d="M0,0 a1,1 0 0,0 5,0">',
'<rect width="5" height="2.5"></rect>',
'<rect width="2.5" height="5"></rect>',
];

/**
* Chart Base prototype.
*
Expand Down Expand Up @@ -976,6 +988,9 @@ ChartBase.STATE = {
r: Config.number(),
}),
}),
pattern: Config.array(),
}).value({
pattern: DEFAULT_POINT_PATTERNS,
}),

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Chart should be pass correctly formatted configuration options to billboard.js 1`] = `"{\\"axis\\":{},\\"color\\":{\\"pattern\\":[\\"#4B9BFF\\",\\"#FFD76E\\",\\"#FF5F5F\\",\\"#9CE269\\",\\"#AF78FF\\",\\"#50D2A0\\",\\"#FF73C3\\",\\"#FFB64E\\",\\"#5FC8FF\\"]},\\"data\\":{\\"colors\\":{},\\"hide\\":false,\\"order\\":\\"desc\\",\\"type\\":\\"line\\",\\"columns\\":[]},\\"grid\\":{\\"x\\":{\\"show\\":true},\\"y\\":{\\"show\\":true}},\\"line\\":{\\"classes\\":[\\"bb-line-dashed-2-2\\",\\"bb-line-dashed-2-3\\",\\"bb-line-dashed-2-4\\",\\"bb-line-dashed-3-2\\",\\"bb-line-dashed-3-3\\",\\"bb-line-dashed-3-4\\",\\"bb-line-dashed-4-2\\",\\"bb-line-dashed-4-3\\",\\"bb-line-dashed-4-4\\"]},\\"loading\\":false,\\"zoom\\":{}}"`;
exports[`Chart should be pass correctly formatted configuration options to billboard.js 1`] = `"{\\"axis\\":{},\\"color\\":{\\"pattern\\":[\\"#4B9BFF\\",\\"#FFD76E\\",\\"#FF5F5F\\",\\"#9CE269\\",\\"#AF78FF\\",\\"#50D2A0\\",\\"#FF73C3\\",\\"#FFB64E\\",\\"#5FC8FF\\"]},\\"data\\":{\\"colors\\":{},\\"hide\\":false,\\"order\\":\\"desc\\",\\"type\\":\\"line\\",\\"columns\\":[]},\\"grid\\":{\\"x\\":{\\"show\\":true},\\"y\\":{\\"show\\":true}},\\"line\\":{\\"classes\\":[\\"bb-line-dashed-2-2\\",\\"bb-line-dashed-2-3\\",\\"bb-line-dashed-2-4\\",\\"bb-line-dashed-3-2\\",\\"bb-line-dashed-3-3\\",\\"bb-line-dashed-3-4\\",\\"bb-line-dashed-4-2\\",\\"bb-line-dashed-4-3\\",\\"bb-line-dashed-4-4\\"]},\\"loading\\":false,\\"point\\":{\\"pattern\\":[\\"circle\\",\\"rectangle\\",\\"<polygon points=\\\\\\"2.5 0 0 5 5 5\\\\\\"></polygon>\\",\\"<polygon points=\\\\\\"2.5 0 0 2.5 2.5 5 5 2.5\\\\\\"></polygon>\\",\\"<polygon points=\\\\\\"0 0 2.5 5 5 0\\\\\\"></polygon>\\",\\"<path d=\\\\\\"M5,5 a1,1 0 1,1 5,0\\\\\\">\\",\\"<path d=\\\\\\"M0,0 a1,1 0 0,0 5,0\\\\\\">\\",\\"<rect width=\\\\\\"5\\\\\\" height=\\\\\\"2.5\\\\\\"></rect>\\",\\"<rect width=\\\\\\"2.5\\\\\\" height=\\\\\\"5\\\\\\"></rect>\\"]},\\"zoom\\":{}}"`;

exports[`Chart should format columns array into billboard.js compatible data 1`] = `"{\\"axis\\":{},\\"color\\":{\\"pattern\\":[\\"#4B9BFF\\",\\"#FFD76E\\",\\"#FF5F5F\\",\\"#9CE269\\",\\"#AF78FF\\",\\"#50D2A0\\",\\"#FF73C3\\",\\"#FFB64E\\",\\"#5FC8FF\\"]},\\"data\\":{\\"colors\\":{\\"data1\\":\\"red\\",\\"data2\\":\\"blue\\"},\\"hide\\":[\\"data1\\"],\\"order\\":\\"desc\\",\\"type\\":\\"line\\",\\"xs\\":{\\"data1\\":\\"x1\\",\\"data2\\":\\"x2\\"},\\"columns\\":[[\\"data1\\",1,2,3],[\\"data2\\",1,2,3]],\\"axes\\":{\\"data1\\":\\"y\\",\\"data2\\":\\"y2\\"},\\"classes\\":{\\"data1\\":\\"data1\\",\\"data2\\":\\"data2\\"},\\"names\\":{\\"data1\\":\\"Data 1\\",\\"data2\\":\\"Data 2\\"},\\"regions\\":{\\"data1\\":[{\\"end\\":2,\\"start\\":1,\\"style\\":\\"dashed\\"}],\\"data2\\":[{\\"end\\":3,\\"start\\":2,\\"style\\":\\"dashed\\"}]},\\"types\\":{\\"data1\\":\\"line\\",\\"data2\\":\\"spline\\"}},\\"grid\\":{\\"x\\":{\\"show\\":true},\\"y\\":{\\"show\\":true}},\\"line\\":{\\"classes\\":[\\"bb-line-dashed-2-2\\",\\"bb-line-dashed-2-3\\",\\"bb-line-dashed-2-4\\",\\"bb-line-dashed-3-2\\",\\"bb-line-dashed-3-3\\",\\"bb-line-dashed-3-4\\",\\"bb-line-dashed-4-2\\",\\"bb-line-dashed-4-3\\",\\"bb-line-dashed-4-4\\"]},\\"loading\\":false,\\"zoom\\":{}}"`;
exports[`Chart should format columns array into billboard.js compatible data 1`] = `"{\\"axis\\":{},\\"color\\":{\\"pattern\\":[\\"#4B9BFF\\",\\"#FFD76E\\",\\"#FF5F5F\\",\\"#9CE269\\",\\"#AF78FF\\",\\"#50D2A0\\",\\"#FF73C3\\",\\"#FFB64E\\",\\"#5FC8FF\\"]},\\"data\\":{\\"colors\\":{\\"data1\\":\\"red\\",\\"data2\\":\\"blue\\"},\\"hide\\":[\\"data1\\"],\\"order\\":\\"desc\\",\\"type\\":\\"line\\",\\"xs\\":{\\"data1\\":\\"x1\\",\\"data2\\":\\"x2\\"},\\"columns\\":[[\\"data1\\",1,2,3],[\\"data2\\",1,2,3]],\\"axes\\":{\\"data1\\":\\"y\\",\\"data2\\":\\"y2\\"},\\"classes\\":{\\"data1\\":\\"data1\\",\\"data2\\":\\"data2\\"},\\"names\\":{\\"data1\\":\\"Data 1\\",\\"data2\\":\\"Data 2\\"},\\"regions\\":{\\"data1\\":[{\\"end\\":2,\\"start\\":1,\\"style\\":\\"dashed\\"}],\\"data2\\":[{\\"end\\":3,\\"start\\":2,\\"style\\":\\"dashed\\"}]},\\"types\\":{\\"data1\\":\\"line\\",\\"data2\\":\\"spline\\"}},\\"grid\\":{\\"x\\":{\\"show\\":true},\\"y\\":{\\"show\\":true}},\\"line\\":{\\"classes\\":[\\"bb-line-dashed-2-2\\",\\"bb-line-dashed-2-3\\",\\"bb-line-dashed-2-4\\",\\"bb-line-dashed-3-2\\",\\"bb-line-dashed-3-3\\",\\"bb-line-dashed-3-4\\",\\"bb-line-dashed-4-2\\",\\"bb-line-dashed-4-3\\",\\"bb-line-dashed-4-4\\"]},\\"loading\\":false,\\"point\\":{\\"pattern\\":[\\"circle\\",\\"rectangle\\",\\"<polygon points=\\\\\\"2.5 0 0 5 5 5\\\\\\"></polygon>\\",\\"<polygon points=\\\\\\"2.5 0 0 2.5 2.5 5 5 2.5\\\\\\"></polygon>\\",\\"<polygon points=\\\\\\"0 0 2.5 5 5 0\\\\\\"></polygon>\\",\\"<path d=\\\\\\"M5,5 a1,1 0 1,1 5,0\\\\\\">\\",\\"<path d=\\\\\\"M0,0 a1,1 0 0,0 5,0\\\\\\">\\",\\"<rect width=\\\\\\"5\\\\\\" height=\\\\\\"2.5\\\\\\"></rect>\\",\\"<rect width=\\\\\\"2.5\\\\\\" height=\\\\\\"5\\\\\\"></rect>\\"]},\\"zoom\\":{}}"`;

exports[`Chart should rerender chart when new columns are passed 1`] = `"{\\"colors\\":{},\\"hide\\":false,\\"order\\":\\"desc\\",\\"type\\":\\"line\\",\\"columns\\":[[\\"data1\\",1,2,3,4]]}"`;

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5749,6 +5749,10 @@ natural-compare@^1.4.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7"

ncp@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/ncp/-/ncp-2.0.0.tgz#195a21d6c46e361d2fb1281ba38b91e9df7bdbb3"

negotiator@0.6.1:
version "0.6.1"
resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.1.tgz#2b327184e8992101177b28563fb5e7102acd0ca9"
Expand Down

0 comments on commit 0a6542d

Please sign in to comment.