一、带滚动条Slider的分组柱状图封装
import React from "react";
import {Axis, Chart, Geom, Legend, Tooltip} from "bizcharts";
// @ts-ignore
import Slider from 'bizcharts-plugin-slider';
// @ts-ignore
import DataSet from '@antv/data-set';
import {dealSliderChange, filterSliderData} from "@/pages/charts/utils/chartsCommon";
interface IGroupedColumnProps {
data: any[]; // 数据源
xAxis: string; // x轴坐标
yAxis: string; // y轴坐标
legendName: string; // 图例对应的变量(数据中表示种类的字段)
color?: string[];
height?: number;
maxLen?: number;
}
/**
* 分组柱状图(两组及两组以上柱状图,可设置滚动条)
* @param props
* @constructor
*/
const GroupedColumn: React.FC<IGroupedColumnProps> = (props) => {
const {height = 400, xAxis, yAxis, data, maxLen, color, legendName} = props;
let flag: boolean = false;
let dv: any;
let ds: any;
// 获取数据中横坐标的个数,作为是否出现滚动条的依据;