Skip to content

Commit

Permalink
Fix docs examples playing
Browse files Browse the repository at this point in the history
  • Loading branch information
veghdev committed Nov 29, 2024
1 parent 5dd2cd0 commit f7df226
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions docs/assets/javascripts/mdchart.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@ class MdChart {
this.id = id
}

async createFromConfig(snippets) {
this.create(await loadAnimations(snippets))
}

async create(snippets) {
const animations = await loadAnimations(snippets)
let chart = Promise.resolve()
for (let i = 0; i < animations.length; i++) {
for (let i = 0; i < snippets.length; i++) {
const number = i + 1
chart = this.animate(('0' + number).slice(-2), animations[i], chart)
chart = this.animate(('0' + number).slice(-2), snippets[i], chart)
}
}

Expand Down
2 changes: 1 addition & 1 deletion docs/tutorial/assets/snippet.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ Promise.all([mdChartLoaded, dataLoaded, configLoaded]).then((results) => {
const config = results[2].default
const MdChart = results[0].default
const mdchart = new MdChart(data, 'tutorial')
mdchart.create(config)
mdchart.createFromConfig(config)
})

0 comments on commit f7df226

Please sign in to comment.