Skip to content

Commit

Permalink
Merge pull request #516 from Kitware/line-scale-options
Browse files Browse the repository at this point in the history
feat(LineChart): Add option for setting x and y scales
  • Loading branch information
jeffbaumes committed Aug 14, 2017
2 parents b5eb48f + b97a702 commit 5f5a0de
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions examples/line-dynamic/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ window.onload = () => {
let vis = new DynamicLineChart(el, {
data,
x: 'index',
xScale: {nice: false, zero: false},
y: 'value'
});
vis.render();
Expand Down
6 changes: 6 additions & 0 deletions plugins/vega/LineChart/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,19 @@ export default class LineChart extends VegaView(VisComponent) {
field: this.options.x,
type: this.options.xType || 'quantitative'
};
if (this.options.xScale) {
spec.encoding.x.scale = this.options.xScale;
}
}

if (this.options.y) {
spec.encoding.y = {
field: this.options.y,
type: this.options.yType || 'quantitative'
};
if (this.options.yScale) {
spec.encoding.y.scale = this.options.yScale;
}
}

if (this.options.series) {
Expand Down

0 comments on commit 5f5a0de

Please sign in to comment.