Skip to content

Commit

Permalink
Merge pull request #432 from Kitware/solid-dots
Browse files Browse the repository at this point in the history
Add opacity option to ScatterPlot
  • Loading branch information
Roni Choudhury committed Oct 7, 2016
2 parents 3d01013 + 5720fe6 commit 4d5e562
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 1 deletion.
4 changes: 4 additions & 0 deletions app/examples/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
"title": "Scatter Plot",
"link": "scatter"
},
{
"title": "Scatter Plot (solid dots)",
"link": "scatter-solid"
},
{
"title": "Line Chart",
"link": "line"
Expand Down
22 changes: 22 additions & 0 deletions app/examples/scatter-solid/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { iris } from '../util/datasets';
import showComponent from '../util/showComponent';

window.onload = () => {
showComponent('ScatterPlot', 'div', {
data: iris,
x: 'petalLength',
y: 'petalWidth',
color: 'sepalLength',
shape: 'species',
width: 620,
height: 500,
opacity: 0.9,
padding: {
top: 20,
bottom: 80,
left: 50,
right: 130
},
renderer: 'svg'
});
};
5 changes: 4 additions & 1 deletion src/candela/components/ScatterPlot/spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
["xAxis.title", ["@get", "x"]],
["yAxis.title", ["@get", "y"]],

// Default to (almost) transparent symbols.
["opacity", 0.01],

["padding", "strict"]
],
[
Expand Down Expand Up @@ -238,7 +241,7 @@
"stroke": {"scale": "color", "field": "color"},
"shape": {"scale": "shape", "field": "shape"},
"fill": {"scale": "color", "field": "color"},
"fillOpacity": {"value": 0.01},
"fillOpacity": {"value": ["@get", "opacity"]},
"strokeWidth": {"value": 2},
"size": {"scale": "size", "field": "size"}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import imageTest from '../../../util/imageTest';

imageTest({
name: 'scatterplot-solid',
url: 'http://localhost:28000/examples/scatter-solid',
selector: '#vis-element',
delay: 1000,
threshold: 0.001
});
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 4d5e562

Please sign in to comment.