Skip to content

Instantly share code, notes, and snippets.

@andredumas
Last active August 19, 2016 03:06
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andredumas/b97cfb46160ff5299a8d to your computer and use it in GitHub Desktop.
Save andredumas/b97cfb46160ff5299a8d to your computer and use it in GitHub Desktop.
TechanJS Accessors Example
/**
* Demonstrating configuring a techanjs plot to accept and plot custom data types.
*/
// Either, update the default plot accessor
// All plots have default accessors. Here we are updating the default and redefining how
// to get close from the data
candlestick.accessor().close(function(d) {
return d.currentBid; // Where d is an item in your supplied array
});
// or
// Construct a new accessor and update it
var accessor = techan.accessor.ohlc()
.close(function(d) {
return d.currentBid; // Where d is an item in your supplied array
});
// Overwrite the plots default with the newly constructed
candlestick.accessor(accessor);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment