双向渐变柱形图

描述:当前是关于Echarts图表中的 柱状图 示例。
 
            option ={
    "backgroundColor":"#000",
    "tooltip": {
        "show": true,
        "backgroundColor": "rgba(0,0,0,0.5)",
        "borderColor": "rgba(0,0,0,0.75)",
        "textStyle": {
            "color": "#fff"
        }
    },
    "legend": {
        "icon": "roundRect",
        "itemWidth": 20,
        "itemHeight": 15,
        "show": true,
        "orient": "horizontal",
        "x": "right",
        "top": "0",
        "itemGap": 30,
        "padding": [
            5,
            0,
            0,
            0
        ],
        "textStyle": {
            "fontSize": 16,
            "color": "rgba(255, 255, 255, 1)"
        },
        "data": [
            {
                "name": "女性",
                "textStyle": {
                    "color": "rgba(184, 91, 255, 1)"
                },
                "itemStyle": {
                    "color": {
                        "type": "linear",
                        "x": 0,
                        "y": 0,
                        "x2": 1,
                        "y2": 0,
                        "colorStops": [
                            {
                                "offset": 0,
                                "color": "rgba(184, 91, 255, 1)"
                            },
                            {
                                "offset": 0.5,
                                "color": "rgba(255, 182, 182, 1)"
                            },
                            {
                                "offset": 0.9,
                                "color": "rgba(255, 182, 182, 1)"
                            }
                        ],
                        "global": false
                    }
                }
            },
            {
                "name": "男性",
                "textStyle": {
                    "color": "rgba(39, 204, 245, 1)"
                },
                "itemStyle": {
                    "color": {
                        "type": "linear",
                        "x": 0,
                        "y": 0,
                        "x2": 1,
                        "y2": 0,
                        "colorStops": [
                            {
                                "offset": 0,
                                "color": "rgba(39, 204, 245, 1)"
                            },
                            {
                                "offset": 0.5,
                                "color": "rgba(0, 72, 255, 1)"
                            },
                            {
                                "offset": 0.5,
                                "color": "rgba(0, 72, 255, 1)"
                            }
                        ],
                        "global": false
                    }
                }
            }
        ]
    },
    "grid": [
        {
            "show": false,
            "left": 50,
            "top": "10%",
            "bottom": "2%",
            "containLabel": true,
            "width": "46%"
        },
        {
            "show": false,
            "left": "46%",
            "top": "10%",
            "bottom": "2%",
            "width": "0%"
        },
        {
            "show": false,
            "right": 0,
            "top": "10%",
            "bottom": "2%",
            "containLabel": true,
            "width": "46%"
        }
    ],
    "xAxis": [
        {
            "type": "value",
            "inverse": true,
            "axisLine": {
                "show": false,
                "lineStyle": {
                    "color": "#eee"
                }
            },
            "axisLabel": {
                "show": false,
                "interval": 0,
                "rotate": 0,
                "textStyle": {
                    "color": "#eee",
                    "fontSize": 16
                }
            },
            "show": true,
            "splitLine": {
                "show": false,
                "lineStyle": {
                    "color": "#eee",
                    "width": "0.5",
                    "type": "solid"
                }
            },
            "axisTick": {
                "show": false
            }
        },
        {
            "gridIndex": 1,
            "show": false
        },
        {
            "gridIndex": 2,
            "axisLine": {
                "show": false,
                "lineStyle": {
                    "color": "#eee"
                }
            },
            "axisLabel": {
                "show": false,
                "rotate": 0,
                "textStyle": {
                    "color": "#eee",
                    "fontSize": 16
                }
            },
            "show": true,
            "splitLine": {
                "show": false,
                "lineStyle": {
                    "color": "#eee",
                    "width": "0.5",
                    "type": "solid"
                }
            },
            "axisTick": {
                "show": false
            },
            "inverse": false
        }
    ],
    "yAxis": [
        {
            "show": true,
            "position": "right",
            "name": "",
            "nameTextStyle": {
                "fontSize": 14,
                "color": "rgba(255, 120, 0, 1)",
                "align": "right",
                "padding": [
                    0,
                    -15,
                    0,
                    0
                ]
            },
            "axisLabel": {
                "show": true,
                "formatter": "{value}",
                "textStyle": {
                    "color": "#eee",
                    "fontSize": 14,
                    "align": "center"
                }
            },
            "axisLine": {
                "show": true,
                "lineStyle": {
                    "width": 1,
                    "color": "rgba(255, 255, 255, 1)"
                }
            },
            "axisTick": {
                "show": false
            },
            "type": "category",
            "data": [
                "小于1岁",
                "1 ~ 9 岁",
                "10 ~ 19 岁",
                "20 ~ 29 岁",
                "30 ~ 39 岁",
                "40 ~ 49 岁",
                "50 ~ 59 岁",
                "大于60岁"
            ],
            "offset": 60,
            "inverse": false
        },
        {
            "gridIndex": 1,
            "type": "category",
            "position": "center",
            "show": true,
            "data": [
                "小于1岁",
                "1 ~ 9 岁",
                "10 ~ 19 岁",
                "20 ~ 29 岁",
                "30 ~ 39 岁",
                "40 ~ 49 岁",
                "50 ~ 59 岁",
                "大于60岁"
            ],
            "axisLabel": {
                "show": false
            },
            "axisLine": {
                "show": false
            },
            "axisTick": {
                "show": false
            },
            "inverse": false
        },
        {
            "show": true,
            "gridIndex": 2,
            "type": "category",
            "inverse": false,
            "position": "left",
            "axisTick": {
                "show": false
            },
            "splitLine": {
                "show": false,
                "lineStyle": {
                    "color": "#eee",
                    "width": "0.5",
                    "type": "solid"
                }
            },
            "data": [
                "小于1岁",
                "1 ~ 9 岁",
                "10 ~ 19 岁",
                "20 ~ 29 岁",
                "30 ~ 39 岁",
                "40 ~ 49 岁",
                "50 ~ 59 岁",
                "大于60岁"
            ],
            "name": "",
            "nameTextStyle": {
                "fontSize": 14,
                "color": "#eee",
                "align": "right",
                "padding": [
                    0,
                    0,
                    0,
                    0
                ]
            },
            "axisLabel": {
                "formatter": "{value}",
                "textStyle": {
                    "color": "rgba(255, 0, 160, 1)",
                    "fontSize": 14,
                    "align": "right"
                },
                "show": false
            },
            "axisLine": {
                "show": true,
                "lineStyle": {
                    "width": 1,
                    "color": "rgba(255, 255, 255, 1)"
                }
            }
        }
    ],
    "series": [
        {
            "name": "女性",
            "type": "bar",
            "xAxisIndex": 0,
            "yAxisIndex": 0,
            "showBackground": false,
            "backgroundStyle": {
                "borderWidth": 1,
                "borderColor": "#fff"
            },
            "label": {
                "show": true,
                "position": "inside",
                "padding": [
                    0,
                    0,
                    0,
                    0
                ],
                "textStyle": {
                    "fontSize": 12,
                    "color": "rgba(255, 255, 255, 1)",
                    "fontWeight": "normal"
                }
            },
            "barWidth": 15,
            "itemStyle": {
                "borderRadius": [
                    10,
                    0,
                    0,
                    10
                ],
                "color": {
                        "type": "linear",
                        "x": 0,
                        "y": 0,
                        "x2": 1,
                        "y2": 0,
                        "colorStops": [
                            {
                                "offset": 0,
                                "color": "rgba(184, 91, 255, 1)"
                            },
                            {
                                "offset": 0.5,
                                "color": "rgba(255, 182, 182, 1)"
                            },
                            {
                                "offset": 0.9,
                                "color": "rgba(255, 182, 182, 1)"
                            }
                        ],
                        "global": false
                    }
            },
            "data": [
                22,
                23,
                4,
                56,
                32,
                5,
                9,
                48
            ]
        },
        {
            "name": "男性",
            "type": "bar",
            "xAxisIndex": 2,
            "yAxisIndex": 2,
            "showBackground": false,
            "backgroundStyle": {
                "borderWidth": 1,
                "borderColor": "#fff"
            },
            "label": {
                "show": true,
                "position": "inside",
                "padding": [
                    50,
                    0,
                    20,
                    0
                ],
                "textStyle": {
                    "fontSize": 14,
                    "color": "rgba(255, 255, 255, 1)",
                    "fontWeight": "normal"
                }
            },
            "barWidth": 15,
            "itemStyle": {
                "borderRadius": [
                    0,
                    10,
                    10,
                    0
                ],
                "color": {
                        "type": "linear",
                        "x": 0,
                        "y": 0,
                        "x2": 1,
                        "y2": 0,
                        "colorStops": [
                            {
                                "offset": 0,
                                "color": "rgba(39, 204, 245, 1)"
                            },
                            {
                                "offset": 0.5,
                                "color": "rgba(0, 72, 255, 1)"
                            },
                            {
                                "offset": 0.5,
                                "color": "rgba(0, 72, 255, 1)"
                            }
                        ],
                        "global": false
                    }
            },
            "data": [
                5,
                19,
                23,
                43,
                34,
                53,
                12,
                48
            ]
        }
    ]
};