Simon He @ simonhe.me

s-charts

Jul 25 · 2day

Author: Simon

中文 Chinese Version

This article is documentation that describes the encapsulated utility functions @simon_he/s-charts

peculiarity: High scalability, flexible and convenient calling

More

Instructions for use

npm i @simon_he/s-charts # install

import { 
  sCharts,
  ...
 } from '@simon_he/s-charts' # Ingestion on demand

Directory structure

sCharts

  • Simplify the use of echarts
  • It can make your code more concise and beautiful
  • Automatically listens for resize events and automatically updates the size of the canvas
  • params:
    • container: string | HTMLElement /* Parent container */
    • options: SChartsOption /* With echarts options, w: initialization width, h: initialization height, theme: echarts subject, all event behaviors starting with on are called */
    • autoResize: boolean /* Whether to adjust the width and height automatically */
const charts = sCharts('#main', {
  w: 500,
  h: 300,
  theme: 'dark',
  xAxis: {
    data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
  },
  yAxis: {},
  series: [
    {
      type: 'bar',
      data: [23, 24, 18, 25, 27, 28, 25],
    },
  ],
})

GitHub

Welcome to PR