1.0.6 • Published 10 years ago

stepify-plotly v1.0.6

Weekly downloads
2
License
MIT
Repository
github
Last release
10 years ago

stepify-plotly

Build Status

As of July 2016 this is useful to convert line charts into step charts in Plotlytm.

##Problem

You have this data:

x = [1,2,3,4,5];
y = [2,4,6,8,10];

but you want a stairstep plot:

not the straight line that Plotly.newPlot('outdiv',{x:x, y:y, mode:'line', type:'scatter'},{}) produces

##Staircase Plot Solution

Alters the x and y data to produce a staircase effect. It makes a copy first with Array.slice() so as not to pollute the original array.

var stepify = require('stepify-plotly');
var trace = {x:x, y:y, mode:'lines', type:'scatter', steps:1};  // stepify looks for steps:1, alters the data, deletes steps:1
Plotly.newPlot('outdiv', stepify(trace), {});

##Safe for regular line plots too

If trace.step is falsy, it is deleted and the plot data is unaltered. If trace.step is absent, trace is passed unaltered.

##Copyright

Copyright 2016 Paul Brewer, Economic and Financial Technology Consulting LLC

##License

The MIT License

###Trademarks

  • Plotlytm is a trademark of Plotly, Inc.

  • stepify-plotly is not an official product of Plotly, Inc., but our 3rd party open source contribution.

  • stepify-plotly is not part of a similarly named npm project called stepify, whatever that may be.

1.0.6

10 years ago

1.0.5

10 years ago

1.0.4

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago