Skip to content

Commit

Permalink
Merge pull request #468 from Kitware/linechart-dots
Browse files Browse the repository at this point in the history
Add option to LineChart to display data dots
  • Loading branch information
Roni Choudhury committed Dec 7, 2016
2 parents 7b28839 + 6772201 commit e28a3c9
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 6 deletions.
4 changes: 4 additions & 0 deletions app/examples/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
"title": "Line Chart",
"link": "line"
},
{
"title": "Line Chart with Points",
"link": "linechart-points"
},
{
"title": "Scatter Plot Matrix",
"link": "scattermatrix"
Expand Down
22 changes: 22 additions & 0 deletions app/examples/linechart-points/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { msft } from '../util/datasets';
import showComponent from '../util/showComponent';

window.onload = () => {
showComponent('LineChart', 'div', {
data: msft,
x: 'date',
y: ['price'],
width: 735,
height: 535,
hoverSize: 50,
padding: {
top: 20,
bottom: 45,
left: 45,
right: 20
},
showPoints: true,
pointSize: 25,
renderer: 'svg'
});
};
1 change: 1 addition & 0 deletions python/pycandela/pycandela/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ def __dir__(self):
def __getattr__(self, name):
return partial(Component, name)


components = ComponentAccessor()

init()
10 changes: 4 additions & 6 deletions src/candela/components/LineChart/spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

// Default to showing the x and y fields on hover.
["hover", ["@merge", [["@get", "x"]], ["@get", "y"]]],
["hoverSize", 20],
["pointSize", 25],

// Default axis titles to x and y field names.
["xAxis.title", ["@get", "x"]],
Expand Down Expand Up @@ -174,12 +174,10 @@
"update": {
"x": {"scale": "x", "field": "x"},
"y": {"scale": "y", "field": "y"},
"stroke": {"scale": "color", "field": "color"},
"shape": {"value": "circle"},
"fill": {"scale": "color", "field": "color"},
"opacity": {"value": 0},
"strokeWidth": {"value": 2},
"size": {"value": ["@get", "hoverSize"]}
"fill": {"scale": "color", "value": ["@get", "yfield"]},
"opacity": {"value": ["@if", ["@get", "showPoints"], 1, 0]},
"size": {"value": ["@add", 0, ["@get", "pointSize"]]}
}
}
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import imageTest from '../../../util/imageTest';

imageTest({
name: 'linechart-points',
url: 'http://localhost:28000/examples/linechart-points',
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 e28a3c9

Please sign in to comment.