Skip to content

Instantly share code, notes, and snippets.

@wlib
Last active October 5, 2017 18:33
Show Gist options
  • Save wlib/41a7952af46b5eda01f5afb47b65d784 to your computer and use it in GitHub Desktop.
Save wlib/41a7952af46b5eda01f5afb47b65d784 to your computer and use it in GitHub Desktop.
function finance_demo(container) {
const { price, summaryTicks, volume } = financeData;
const options = {
container,
data: {
price,
summary: price,
volume
},
trackFormatter(o) {
const { data } = o.series;
const index = data[o.index][0];
const { date, close, volume } = summaryTicks[index];
return `${date}: $${close}, Vol: ${volume}`;
},
xTickFormatter(index) {
const date = new Date(summaryTicks[index].date);
return date.getFullYear().toString();
},
// An initial selection
selection: {
data: {
x: {
min: 100,
max: 200
}
}
}
};
return new envision.templates.Finance(options);
}
finance_demo(document.querySelector("#editor-render-0"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment