0.0.7 • Published 2 years ago

@ziho/video-echarts v0.0.7

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

eCharts enhance

Usage

Install

pnpm add @ziho/video-echarts
# or
npm install @ziho/video-echarts

Example

  • basic usage

import { init } from '@ziho/video-echarts'

// same as echarts
const ec = init(document.querySelector('#chart'))
  • use listeners
ec.listen('beforeReplay', () => {
  console.log('before replay')
})

ec.listen('afterReplay', () => {
  console.log('after replay')
})
  • record video
ec.useRecord({ mode: 'record' })

const videoHandler = (data) => {
  console.log('videoAvaliable, data is blob')
}
ec.listen('videoAvaliable', videoHandler)
ec.replay()

// cancel the videoAvaliable listener
ec.unlisten('videoAvaliable', videoHandler)
  • capture images
ec.useRecord({ mode: 'capture' })
ec.listen('capture', (data) => {
  console.log('capture, data is image base64 array')
})
ec.replay()


// you also can use ec.on('rendered', () => {}) and ec.on('finished', () => {})
// to capture more frames of echarts animation
const imgs = []
ec.on('rendered', () => {
  console.log('rendered')
  imgs.push(ec.getDataURL())
})

ec.on('finished', () => {
  console.log('finished', imgs)
})

Feature

  • echarts.replay

    • listener: beforeReplay
    • listener: afterReplay
  • record echarts to video

    • listener: videoAvaliable
  • mediaRecorder

  • imageCapture
0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago