Skip to content

Commit

Permalink
generate data for better line chart
Browse files Browse the repository at this point in the history
  • Loading branch information
ming-codes committed Sep 17, 2015
1 parent c46089c commit e9769c1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion tests/dummy/app/templates/gallery/lines.hbs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{#block-page visual=model}}
{{#data-visual as |svg width height|}}
{{#cart-lines select=(transition svg.chart) model=dimensionalData width=width height=height
margin="10 10 25 65" stroke=(color-scale "category10")
margin="10 30 25 65" stroke=(color-scale "category10")
as |selection x-scale y-scale width height|}}

{{cart-axis select=(transition svg.chart.x-axis) scale=x-scale
Expand Down
7 changes: 2 additions & 5 deletions tests/helpers/data-generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,11 @@ export function randomInt() {
return Math.floor(Date.now() * Math.random());
}

export function dimensional(series, count = 4, options = {}) {
export function dimensional(series, count = 8, options = {}) {
var generator = d3.random.normal(options.mean || 2000, options.stddev || 2000);
var scale = d3.scale.linear()
.domain([ 0, count ])
.range([ randomInt(), randomInt() ].sort());

return d3.range(count).map(id => {
var base = { id, state: states[id], timestamp: new Date(scale(id)) };
var base = { id, state: states[id], timestamp: new Date(id * 3.15569e10 * 2) };

series.forEach(series => {
base[series] = generator();
Expand Down

0 comments on commit e9769c1

Please sign in to comment.