Convert Figma logo to code with AI

ElemeFE logov-charts

基于 Vue2.0 和 ECharts 封装的图表组件📈📊

6,798
1,982
6,798
355

Top Related Projects

60,384

Apache ECharts is a powerful, interactive charting and data visualization library for browser

64,568

Simple HTML5 Charts using the <canvas> tag

108,427

Bring data to life with SVG, Canvas and HTML. :bar_chart::chart_with_upwards_trend::tada:

Highcharts JS, the JavaScript charting framework

16,856

Open-source JavaScript charting library behind Plotly and Dash

101,622

JavaScript 3D Library.

Quick Overview

V-Charts is a charting library for Vue.js that wraps ECharts to provide a more Vue-friendly API. It simplifies the process of creating charts in Vue applications by offering a set of components that can be easily integrated and customized.

Pros

  • Easy integration with Vue.js projects
  • Simplified API compared to using ECharts directly
  • Wide variety of chart types available
  • Responsive and interactive charts out of the box

Cons

  • Limited customization options compared to using ECharts directly
  • Dependency on both Vue.js and ECharts
  • Less frequent updates compared to ECharts
  • Documentation could be more comprehensive

Code Examples

  1. Creating a basic line chart:
<template>
  <ve-line :data="chartData"></ve-line>
</template>

<script>
export default {
  data() {
    return {
      chartData: {
        columns: ['date', 'sales'],
        rows: [
          { date: '2021-01-01', sales: 123 },
          { date: '2021-01-02', sales: 234 },
          { date: '2021-01-03', sales: 345 },
        ]
      }
    }
  }
}
</script>
  1. Creating a pie chart with custom colors:
<template>
  <ve-pie :data="chartData" :settings="chartSettings"></ve-pie>
</template>

<script>
export default {
  data() {
    return {
      chartData: {
        columns: ['item', 'count'],
        rows: [
          { item: 'Apple', count: 1000 },
          { item: 'Orange', count: 2000 },
          { item: 'Banana', count: 1500 }
        ]
      },
      chartSettings: {
        color: ['#1f77b4', '#ff7f0e', '#2ca02c']
      }
    }
  }
}
</script>
  1. Creating a responsive bar chart:
<template>
  <ve-bar :data="chartData" :settings="chartSettings" :extend="chartExtend"></ve-bar>
</template>

<script>
export default {
  data() {
    return {
      chartData: {
        columns: ['month', 'sales'],
        rows: [
          { month: 'Jan', sales: 100 },
          { month: 'Feb', sales: 150 },
          { month: 'Mar', sales: 200 }
        ]
      },
      chartSettings: {
        yAxisType: ['KMB']
      },
      chartExtend: {
        series: {
          barWidth: '50%'
        },
        grid: {
          containLabel: true
        }
      }
    }
  }
}
</script>

Getting Started

  1. Install v-charts:

    npm install v-charts echarts
    
  2. Import and use in your Vue.js project:

    import Vue from 'vue'
    import VCharts from 'v-charts'
    
    Vue.use(VCharts)
    
  3. Use v-charts components in your Vue templates:

    <template>
      <ve-line :data="chartData"></ve-line>
    </template>
    
  4. Provide data in the required format:

    data() {
      return {
        chartData: {
          columns: ['date', 'value'],
          rows: [
            { date: '2021-01-01', value: 100 },
            { date: '2021-01-02', value: 200 },
            { date: '2021-01-03', value: 300 }
          ]
        }
      }
    }
    

Competitor Comparisons

60,384

Apache ECharts is a powerful, interactive charting and data visualization library for browser

Pros of ECharts

  • More comprehensive and feature-rich charting library
  • Supports a wider range of chart types and customization options
  • Better performance for large datasets and complex visualizations

Cons of ECharts

  • Steeper learning curve due to its extensive API and options
  • Larger file size, which may impact load times for smaller projects

Code Comparison

v-charts:

import VCharts from 'v-charts'
Vue.use(VCharts)

<ve-line :data="chartData"></ve-line>

ECharts:

import * as echarts from 'echarts'

const chart = echarts.init(document.getElementById('chart'))
chart.setOption({
  // Chart configuration
})

Key Differences

  • v-charts is specifically designed for Vue.js integration, while ECharts is a standalone library that can be used with various frameworks
  • v-charts provides a higher-level abstraction, making it easier to create charts quickly with less code
  • ECharts offers more fine-grained control over chart appearance and behavior
  • v-charts has a smaller community and fewer updates compared to ECharts

Use Cases

  • Choose v-charts for rapid prototyping and simple charts in Vue.js projects
  • Opt for ECharts when you need advanced customization, complex visualizations, or framework-agnostic solutions
64,568

Simple HTML5 Charts using the <canvas> tag

Pros of Chart.js

  • More versatile and can be used with various frameworks, not limited to Vue.js
  • Larger community and more extensive documentation
  • Offers a wider range of chart types and customization options

Cons of Chart.js

  • Requires more setup and configuration compared to v-charts
  • Less integrated with Vue.js ecosystem, may require additional wrapper components

Code Comparison

v-charts:

import VCharts from 'v-charts'
Vue.use(VCharts)

<ve-line :data="chartData"></ve-line>

Chart.js:

import Chart from 'chart.js/auto'

new Chart(ctx, {
    type: 'line',
    data: chartData,
    options: chartOptions
})

Summary

Chart.js is a more flexible and widely-used charting library that offers extensive customization options and supports various frameworks. It has a larger community and more comprehensive documentation. However, it requires more setup and configuration compared to v-charts.

v-charts, on the other hand, is specifically designed for Vue.js and provides a more streamlined integration with Vue components. It offers simpler implementation but may have limitations in terms of customization and chart types compared to Chart.js.

The choice between the two depends on the specific project requirements, the desired level of customization, and the developer's familiarity with Vue.js ecosystem.

108,427

Bring data to life with SVG, Canvas and HTML. :bar_chart::chart_with_upwards_trend::tada:

Pros of d3

  • Highly flexible and customizable, allowing for complex and unique visualizations
  • Extensive library with a wide range of chart types and data manipulation tools
  • Large community and ecosystem with numerous extensions and resources

Cons of d3

  • Steeper learning curve, requiring more time to master
  • More code required for basic charts compared to higher-level libraries
  • Less out-of-the-box responsiveness and mobile optimization

Code Comparison

d3:

const svg = d3.select("body").append("svg")
    .attr("width", 400)
    .attr("height", 300);

svg.selectAll("rect")
    .data(data)
    .enter()
    .append("rect")
    .attr("x", (d, i) => i * 70)
    .attr("y", (d, i) => 300 - 10 * d)
    .attr("width", 65)
    .attr("height", (d, i) => d * 10);

v-charts:

<template>
  <ve-histogram :data="chartData"></ve-histogram>
</template>

<script>
export default {
  data: () => ({
    chartData: {
      columns: ['date', 'cost', 'profit'],
      rows: [
        { 'date': '1/1', 'cost': 123, 'profit': 3 },
        { 'date': '1/2', 'cost': 1223, 'profit': 6 },
        { 'date': '1/3', 'cost': 2123, 'profit': 9 }
      ]
    }
  })
}
</script>

Highcharts JS, the JavaScript charting framework

Pros of Highcharts

  • More extensive and feature-rich charting library
  • Supports a wider range of chart types and customization options
  • Better documentation and community support

Cons of Highcharts

  • Requires a commercial license for most use cases
  • Steeper learning curve due to its extensive API
  • Larger file size, which may impact page load times

Code Comparison

v-charts:

<ve-line :data="chartData" :settings="chartSettings"></ve-line>

Highcharts:

Highcharts.chart('container', {
  series: [{
    data: [1, 2, 3, 4, 5]
  }]
});

Key Differences

  • v-charts is specifically designed for Vue.js, while Highcharts is framework-agnostic
  • v-charts offers a simpler API with Vue-specific components
  • Highcharts provides more advanced features and customization options
  • v-charts is free and open-source, while Highcharts requires a license for commercial use

Use Cases

  • Choose v-charts for quick and easy chart integration in Vue.js projects
  • Opt for Highcharts when advanced charting capabilities and extensive customization are required

Performance

  • v-charts may have better performance in Vue.js applications due to its integration
  • Highcharts generally offers better performance for complex charts and large datasets

Community and Ecosystem

  • Highcharts has a larger community and more third-party extensions
  • v-charts has a smaller but growing community focused on Vue.js developers
16,856

Open-source JavaScript charting library behind Plotly and Dash

Pros of plotly.js

  • More comprehensive and feature-rich, supporting a wider range of chart types
  • Better performance for large datasets and complex visualizations
  • Extensive documentation and community support

Cons of plotly.js

  • Steeper learning curve due to its complexity
  • Larger file size, which may impact load times for web applications

Code Comparison

v-charts:

import VCharts from 'v-charts'
Vue.use(VCharts)

<ve-line :data="chartData"></ve-line>

plotly.js:

import Plotly from 'plotly.js-dist'

Plotly.newPlot('myDiv', data, layout, config)

Key Differences

v-charts is specifically designed for Vue.js applications, offering a more straightforward integration with Vue components. It provides a higher-level abstraction, making it easier to create charts quickly with less code.

plotly.js is a more versatile and powerful library that can be used with various frameworks or vanilla JavaScript. It offers more customization options and advanced features but requires more setup and configuration.

Both libraries have their strengths, and the choice between them depends on the specific needs of the project, such as the complexity of visualizations required, performance considerations, and the development framework being used.

101,622

JavaScript 3D Library.

Pros of three.js

  • More versatile and powerful for 3D graphics and animations
  • Larger community and ecosystem with extensive documentation
  • Supports a wide range of 3D features, including WebGL and WebXR

Cons of three.js

  • Steeper learning curve due to its complexity and breadth of features
  • Heavier library size, which may impact load times for simpler projects
  • Requires more manual setup and configuration compared to v-charts

Code Comparison

three.js:

const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);
const renderer = new THREE.WebGLRenderer();
renderer.setSize(window.innerWidth, window.innerHeight);
document.body.appendChild(renderer.domElement);

v-charts:

import VCharts from 'v-charts';
Vue.use(VCharts);

<ve-line :data="chartData"></ve-line>

Summary

three.js is a powerful 3D graphics library with a vast ecosystem, making it ideal for complex 3D visualizations and games. However, it has a steeper learning curve and larger file size. v-charts, on the other hand, is more focused on creating charts and graphs within Vue.js applications, offering simpler implementation but with less flexibility for 3D graphics.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

mark text

v-charts

Build Status NPM downloads Npm package Language License Join the chat

Document | Sample Project | English | 中文

Chart components based on Vue2.x and Echarts

Features

  • Uniform data format: Use an uniform data format that both convient for frontend and backend, and also easy to create and edit.
  • Simplified configuration: With simplified configuration items, complex requirements can be easily implemented.
  • Simple customization: Provide a variety of custom Echarts way, you can easily set the chart options.

Support

Modern browsers and Internet Explorer 10+, include pc and mobile browser.

Install

npm i v-charts echarts -S

Start

<template>
  <div>
    <ve-line :data="chartData"></ve-line>
  </div>
</template>

<script>
import VeLine from 'v-charts/lib/line.common'
export default {
  components: { VeLine },
  data () {
    return {
      chartData: {
        columns: ['date', 'PV'],
        rows: [
          { 'date': '01-01', 'PV': 1231 },
          { 'date': '01-02', 'PV': 1223 },
          { 'date': '01-03', 'PV': 2123 },
          { 'date': '01-04', 'PV': 4123 },
          { 'date': '01-05', 'PV': 3123 },
          { 'date': '01-06', 'PV': 7123 }
        ]
      }
    }
  }
}
</script>

Changelog

Detailed changes for each release are documented in the release notes or ChangeLog.

Contribution

Please make sure to read the Contributing Guide before making a pull request.

License

MIT

NPM DownloadsLast 30 Days