BizCharts Documentation

repository·master·Indexed 27 days ago

https://github.com/alibaba/bizcharts

A React-based charting and visualization library using an ES6 grammar for defining charts. It provides a wide range of data visualizations and G components such as Canvas, Circle, Ellipse, Group, Image, Line, Marker, Path, Polygon, Polyline, and Rect. Note: BizCharts is no longer being actively maintained, and users are encouraged to migrate to the AntV ecosystem.

Tokens
461.4K
Snippets
736
Records
1.3K
Agent score
91%

What's inside BizCharts

  1. Overview of Annotation components

    master

    The Annotation component provides auxiliary elements to mark additional information on a chart. Available annotation types include:

    • Annotation.Line: Auxiliary lines (can include text), e.g., for average values or expected distributions.
    • Annotation.Arc: Auxiliary arcs, effective only in polar coordinate systems (e.g., for gauges).
    • Annotation.Text: Auxiliary text at a specified position.
    • Annotation.Image: Auxiliary images added to the chart.
    • Annotation.Region: Auxiliary boxes to select a chart area, allowing settings for background, borders, etc.
    • Annotation.RegionFilter: Area coloring that extracts and recolors elements within a rectangular selection.
    • Annotation.DataMarker: Special data point annotations, commonly used in line and area charts.
    • Annotation.DataRegion: Special data region annotations, commonly used in line and area charts.
    • Annotation.Html: Custom HTML-based graphical annotations.
  2. Use the View component for heterogeneous data and multi-layer charts

    master

    The View component is generated and managed by a Chart. Each View possesses its own independent data source, coordinate system, and layers. Use View to achieve:

    • Multi-layer charts: When displaying multiple charts with different coordinate systems in the same container (e.g., multi-layer pie charts).
    • Heterogeneous data visualization: When charts in the same container require different data sources (e.g., comparative funnel charts).

    Note: The API available on a View is largely identical to that of a Chart.

  3. Understand Geom (Geometric Marks) in BizCharts

    master
    In BizCharts, there are no predefined chart types like 'Bar Chart' or 'Line Chart'. Instead, chart types are determined by the combination of Geom (Geometric Marks) and the Coordinate System. A Geom represents geometric primitives such as points, lines, or areas. By configuring different Geoms, you can create various chart types or even combine them (e.g., a combination of line and bar charts).
  4. Important Notice: Migration to AntV recommended

    master

    Due to organizational changes, BizCharts is no longer being actively maintained. The official website database will be taken offline.

    Recommendation: Users are encouraged to migrate to the AntV ecosystem. Since the AntV API is the same source as BizCharts, the migration cost is low. Documentation for BizCharts has been moved to the docs directory within this repository.

  5. DataSet Core Capabilities

    master

    The DataSet module provides two primary stages of data processing:

    1. Data Connection (Connector): Responsible for importing and normalizing data (e.g., converting CSV or GeoJSON into standard JSON).
    2. Data Transformation (Transform): Responsible for various operations:
      • Data Processing: filter, map, fold (data completion), etc.
      • Statistical Functions: Aggregation, percentage, binning, etc.
      • Specialized Processing: Handling geographic data, treemaps, Sankey diagrams, and word clouds.
  6. Use the LineAdvance component for advanced line charts

    master

    The LineAdvance component is an enhanced version of the standard Line component. While <Line /> only draws lines, <LineAdvance /> provides advanced presets for line charts, including data points (points), gradient area projections (area), and more complex styling. It was introduced in version ^4.0.12.

    Basic data format example:

    const data = [
     {"x": "1991", "y": 123, "type": "A"},
     {"x": "1991", "y": 123, "type": "B"},
     {"x": "1992", "y": 123, "type": "A"},
     {"x": "1992", "y": 123, "type": "B"},
     {"x": "1993", "y": 123, "type": "A"},
     {"x": "1993", "y": 123, "type": "B"}
    ]
    <Chart data={data} width={500} autoFit >
      <LineAdvance position="x*y" color="type" />
    </Chart>
  7. Modify built-in interactions using defaultInteractions

    master

    You can change or restrict the default built-in interactions (like tooltip, legend-active, legend-filter, and continuous-filter) by passing the defaultInteractions prop to the Chart component. This prop accepts an array of interaction names.

    Example: To keep only the tooltip interaction, pass ['tooltip'] to defaultInteractions.

    <Chart
      scale={scale}
      height={500}
      data={source}
      autoFit
      defaultInteractions={['tooltip']} // Only keeps tooltip
    >
    </Chart>
  8. Use RangeBarChart in React

    master

    You can use RangeBarChart in your React application using either full destructuring or on-demand (tree-shaking) imports.

    Full destructuring:

    import { RangeBarChart } from 'bizcharts';

    On-demand import (ESM):

    import RangeBarChart from 'bizcharts/lib/plots/RangeBarChart';
    // Or for es modules:
    import RangeBarChart from 'bizcharts/es/plots/RangeBarChart';
    import { RangeBarChart } from 'bizcharts';
    
    function APP() {
      return <RangeBarChart {...options} />;
    }