Last active
October 5, 2017 18:33
-
-
Save wlib/41a7952af46b5eda01f5afb47b65d784 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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