横向柱状图完整配置项

普通

{
    "backgroundColor": "#fff",
    "color": [
        "#88AAFF",
        "#9AE9A1",
        "#6FD4D6",
        "#F5D45F",
        "#F4928B",
        "#DAA78E",
        "#FB7293",
        "#E062AE",
        "#E690D1",
        "#E7BCF3",
        "#9D96F5",
        "#8378EA"
    ],
    "title": {
        "show": true,
        "text": "横向柱图",
        "textStyle": {
            "fontFamily": "Microsoft YaHei,PingFang SC Regular",
            "fontWeight": "800",
            "fontSize": 14,
            "color": "#666"
        },
        "left": "left",
        "top": "top"
    },
    "legend": {
        "show": true,
        "top": "bottom",
        "left": "center",
        "orient": "horizontal",
        "textStyle": {
            "color": "#666",
            "fontSize": 12
        },
        "selected": {
            "产线1": true,
            "产线2": true
        }
    },
    "dataZoom": [
        {
            "show": false,
            "height": 14,
            "start": 0,
            "end": 100,
            "bottom": 26
        }
    ],
    "grid": [
        {
            "left": "50px",
            "right": "100px",
            "bottom": "35px",
            "top": "50px",
            "containLabel": true
        }
    ],
    "xAxis": {
        "type": "value",
        "gridIndex": 0,
        "name": "",
        "show": true,
        "minInterval": true,
        "splitLine": {
            "show": false,
            "lineStyle": {
                "color": "#ccc",
                "type": "dashed"
            }
        },
        "axisLine": {
            "show": true,
            "margin": 8,
            "lineStyle": {
                "textAlign": "left",
                "color": "#ccc"
            }
        },
        "axisLabel": {
            "show": true,
            "rotate": "0",
            "fontSize": 12,
            "color": "#666"
        },
        "axisTick": {
            "alignWithLabel": false
        }
    },
    "yAxis": {
        "gridIndex": 0,
        "minInterval": 1,
        "show": true,
        "type": "category",
        "splitLine": {
            "show": true,
            "lineStyle": {
                "color": "#ccc",
                "type": "dashed"
            }
        },
        "name": "",
        "position": "left",
        "offset": 0,
        "axisLine": {
            "show": true,
            "lineStyle": {
                "color": "#ccc"
            }
        },
        "axisLabel": {
            "show": true,
            "fontSize": 12,
            "color": "#666"
        }
    },
    "tooltip": {
        "confine": true,
        "show": true,
        "trigger": "axis",
        "triggerOn": "mousemove",
        "borderColor": "#fff",
        "backgroundColor": "#fff",
        "textStyle": {
            "fontSize": 12,
            "color": "#666"
        }
    },
    "dataset": {
        "dimensions": [
            {
                "name": "day",
                "dataType": "STRING"
            },
            {
                "name": "产线1",
                "dataType": "INT"
            },
            {
                "name": "产线2",
                "dataType": "INT"
            },
            {
                "name": "产线3",
                "dataType": "INT"
            }
        ],
        "source": [
            {
                "day": "周一",
                "产线1": 43.3,
                "产线2": 85.8,
                "产线3": 53.7
            },
            {
                "day": "周二",
                "产线1": 83.1,
                "产线2": 73.4,
                "产线3": 55.1
            },
            {
                "day": "周三",
                "产线1": 76.4,
                "产线2": 65.2,
                "产线3": 82.5
            }
        ]
    },
    "series": [
        {
            "endLabel": {
                "show": false
            },
            "name": "产线1",
            "symbolSize": 3,
            "barWidth": 25,
            "smooth": false,
            "type": "bar",
            "markPoint": {
                "data": [
                    {
                        "type": "min",
                        "name": "最小值"
                    },
                    {
                        "type": "max",
                        "name": "最大值"
                    }
                ],
                "symbolSize": 60,
                "label": {
                    "show": true,
                    "color": "#fff",
                    "fontSize": 16
                }
            },
            "stack": "",
            "itemStyle": {
                "borderColor": null,
                "borderWidth": 2,
                "borderType": "solid"
            },
            "minInterval": true,
            "label": {
                "show": false,
                "position": "insideTop",
                "fontSize": 12,
                "color": "#666"
            },
            "lineStyle": {
                "width": 3
            },
            "markLine": {
                "symbol": "none",
                "data": []
            },
            "color": {
                "x": "0",
                "y": "0",
                "x2": "1",
                "y2": "0",
                "type": "linear",
                "global": false,
                "colorStops": [
                    {
                        "offset": 0,
                        "color": "rgba(136,170,255,1)"
                    },
                    {
                        "offset": 1,
                        "color": "rgba(136,170,255,1)"
                    }
                ]
            },
            "areaStyle": {
                "color": {
                    "x": "0",
                    "y": "0",
                    "x2": "1",
                    "y2": "0",
                    "type": "linear",
                    "global": false,
                    "colorStops": [
                        {
                            "offset": 0,
                            "color": "rgba(136,170,255,1)"
                        },
                        {
                            "offset": 1,
                            "color": "rgba(136,170,255,1)"
                        }
                    ]
                }
            },
            "barGap": "30%",
            "encode": {
                "x": "产线1",
                "y": "day"
            }
        },
        {
            "endLabel": {
                "show": false
            },
            "name": "产线2",
            "symbolSize": 3,
            "barWidth": 25,
            "smooth": false,
            "type": "bar",
            "markPoint": {
                "data": [
                    {
                        "type": "min",
                        "name": "最小值"
                    },
                    {
                        "type": "max",
                        "name": "最大值"
                    }
                ],
                "symbolSize": 60,
                "label": {
                    "show": true,
                    "color": "#fff",
                    "fontSize": 16
                }
            },
            "stack": "",
            "itemStyle": {
                "borderColor": null,
                "borderWidth": 2,
                "borderType": "solid"
            },
            "minInterval": true,
            "label": {
                "show": false,
                "position": "insideTop",
                "fontSize": 12,
                "color": "#666"
            },
            "lineStyle": {
                "width": 3
            },
            "markLine": {
                "symbol": "none",
                "data": []
            },
            "color": {
                "x": "0",
                "y": "0",
                "x2": "1",
                "y2": "0",
                "type": "linear",
                "global": false,
                "colorStops": [
                    {
                        "offset": 0,
                        "color": "rgba(154,233,161,1)"
                    },
                    {
                        "offset": 1,
                        "color": "rgba(154,233,161,1)"
                    }
                ]
            },
            "areaStyle": {
                "color": {
                    "x": "0",
                    "y": "0",
                    "x2": "1",
                    "y2": "0",
                    "type": "linear",
                    "global": false,
                    "colorStops": [
                        {
                            "offset": 0,
                            "color": "rgba(154,233,161,1)"
                        },
                        {
                            "offset": 1,
                            "color": "rgba(154,233,161,1)"
                        }
                    ]
                }
            },
            "barGap": "30%",
            "encode": {
                "x": "产线2",
                "y": "day"
            }
        }
    ]
}

堆叠

{
    "backgroundColor": "#fff",
    "color": [
        "#88AAFF",
        "#9AE9A1",
        "#6FD4D6",
        "#F5D45F",
        "#F4928B",
        "#DAA78E",
        "#FB7293",
        "#E062AE",
        "#E690D1",
        "#E7BCF3",
        "#9D96F5",
        "#8378EA"
    ],
    "title": {
        "show": true,
        "text": "横向堆叠柱图",
        "textStyle": {
            "fontFamily": "Microsoft YaHei,PingFang SC Regular",
            "fontWeight": "800",
            "fontSize": 14,
            "color": "#666"
        },
        "left": "left",
        "top": "top"
    },
    "legend": {
        "show": true,
        "top": "bottom",
        "left": "center",
        "orient": "horizontal",
        "textStyle": {
            "color": "#666",
            "fontSize": 12
        },
        "selected": {
            "产线1": true,
            "产线2": true
        }
    },
    "dataZoom": [
        {
            "show": false,
            "height": 14,
            "start": 0,
            "end": 100,
            "bottom": 26
        }
    ],
    "grid": [
        {
            "left": "50px",
            "right": "100px",
            "bottom": "35px",
            "top": "50px",
            "containLabel": true
        }
    ],
    "xAxis": {
        "type": "value",
        "gridIndex": 0,
        "name": "",
        "show": true,
        "minInterval": true,
        "splitLine": {
            "show": false,
            "lineStyle": {
                "color": "#ccc",
                "type": "dashed"
            }
        },
        "axisLine": {
            "show": true,
            "margin": 8,
            "lineStyle": {
                "textAlign": "left",
                "color": "#ccc"
            }
        },
        "axisLabel": {
            "show": true,
            "rotate": "0",
            "fontSize": 12,
            "color": "#666"
        },
        "axisTick": {
            "alignWithLabel": false
        }
    },
    "yAxis": {
        "gridIndex": 0,
        "minInterval": 1,
        "show": true,
        "type": "category",
        "splitLine": {
            "show": true,
            "lineStyle": {
                "color": "#ccc",
                "type": "dashed"
            }
        },
        "name": "",
        "position": "left",
        "offset": 0,
        "axisLine": {
            "show": true,
            "lineStyle": {
                "color": "#ccc"
            }
        },
        "axisLabel": {
            "show": true,
            "fontSize": 12,
            "color": "#666"
        }
    },
    "tooltip": {
        "confine": true,
        "show": true,
        "trigger": "axis",
        "triggerOn": "mousemove",
        "borderColor": "#fff",
        "backgroundColor": "#fff",
        "textStyle": {
            "fontSize": 12,
            "color": "#666"
        }
    },
    "dataset": {
        "dimensions": [
            {
                "name": "day",
                "dataType": "STRING"
            },
            {
                "name": "产线1",
                "dataType": "INT"
            },
            {
                "name": "产线2",
                "dataType": "INT"
            },
            {
                "name": "产线3",
                "dataType": "INT"
            }
        ],
        "source": [
            {
                "day": "周一",
                "产线1": 43.3,
                "产线2": 85.8,
                "产线3": 53.7
            },
            {
                "day": "周二",
                "产线1": 83.1,
                "产线2": 73.4,
                "产线3": 55.1
            },
            {
                "day": "周三",
                "产线1": 76.4,
                "产线2": 65.2,
                "产线3": 82.5
            }
        ]
    },
    "series": [
        {
            "endLabel": {
                "show": false
            },
            "name": "产线1",
            "symbolSize": 3,
            "barWidth": 25,
            "smooth": false,
            "type": "bar",
            "markPoint": {
                "data": [
                    {
                        "type": "min",
                        "name": "最小值"
                    },
                    {
                        "type": "max",
                        "name": "最大值"
                    }
                ],
                "symbolSize": 60,
                "label": {
                    "show": true,
                    "color": "#fff",
                    "fontSize": 16
                }
            },
            "stack": "总量",
            "itemStyle": {
                "borderColor": null,
                "borderWidth": 2,
                "borderType": "solid"
            },
            "minInterval": true,
            "label": {
                "show": false,
                "position": "insideTop",
                "fontSize": 12,
                "color": "#666"
            },
            "lineStyle": {
                "width": 3
            },
            "markLine": {
                "symbol": "none",
                "data": []
            },
            "color": {
                "x": "0",
                "y": "0",
                "x2": "1",
                "y2": "0",
                "type": "linear",
                "global": false,
                "colorStops": [
                    {
                        "offset": 0,
                        "color": "rgba(136,170,255,1)"
                    },
                    {
                        "offset": 1,
                        "color": "rgba(136,170,255,1)"
                    }
                ]
            },
            "areaStyle": {
                "color": {
                    "x": "0",
                    "y": "0",
                    "x2": "1",
                    "y2": "0",
                    "type": "linear",
                    "global": false,
                    "colorStops": [
                        {
                            "offset": 0,
                            "color": "rgba(136,170,255,1)"
                        },
                        {
                            "offset": 1,
                            "color": "rgba(136,170,255,1)"
                        }
                    ]
                }
            },
            "encode": {
                "x": "产线1",
                "y": "day"
            }
        },
        {
            "endLabel": {
                "show": false
            },
            "name": "产线2",
            "symbolSize": 3,
            "barWidth": 25,
            "smooth": false,
            "type": "bar",
            "markPoint": {
                "data": [
                    {
                        "type": "min",
                        "name": "最小值"
                    },
                    {
                        "type": "max",
                        "name": "最大值"
                    }
                ],
                "symbolSize": 60,
                "label": {
                    "show": true,
                    "color": "#fff",
                    "fontSize": 16
                }
            },
            "stack": "总量",
            "itemStyle": {
                "borderColor": null,
                "borderWidth": 2,
                "borderType": "solid"
            },
            "minInterval": true,
            "label": {
                "show": false,
                "position": "insideTop",
                "fontSize": 12,
                "color": "#666"
            },
            "lineStyle": {
                "width": 3
            },
            "markLine": {
                "symbol": "none",
                "data": []
            },
            "color": {
                "x": "0",
                "y": "0",
                "x2": "1",
                "y2": "0",
                "type": "linear",
                "global": false,
                "colorStops": [
                    {
                        "offset": 0,
                        "color": "rgba(154,233,161,1)"
                    },
                    {
                        "offset": 1,
                        "color": "rgba(154,233,161,1)"
                    }
                ]
            },
            "areaStyle": {
                "color": {
                    "x": "0",
                    "y": "0",
                    "x2": "1",
                    "y2": "0",
                    "type": "linear",
                    "global": false,
                    "colorStops": [
                        {
                            "offset": 0,
                            "color": "rgba(154,233,161,1)"
                        },
                        {
                            "offset": 1,
                            "color": "rgba(154,233,161,1)"
                        }
                    ]
                }
            },
            "encode": {
                "x": "产线2",
                "y": "day"
            }
        }
    ]
}
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容