Display bar chart with thumbnails in yAxis instead of label

后端 未结 2 2129
猫巷女王i
猫巷女王i 2021-01-25 22:36

I am using two charts libraries in my project. ECharts and Google Charts.

I want to display bar chart with thumbnails. I need to display log of banners.

So i wil

2条回答
  •  借酒劲吻你
    2021-01-25 22:42

    echarts support rich text as label

    in the option yAxis or xAixs -> axisLabel -> rich,

    check this example1 example2

    yAxis: {
        type: 'category',
        data: ['Sunny', 'Cloudy', 'Showers'],
        axisLabel: {
            formatter: function (value) {
                return '{' + value + '| }\n{value|' + value + '}';
            },
            margin: 20,
            rich: {
                value: {
                    lineHeight: 30,
                    align: 'center'
                },
                Sunny: {
                    height: 40,
                    align: 'center',
                    backgroundColor: {
                        image: weatherIcons.Sunny
                    }
                },
                Cloudy: {
                    height: 40,
                    align: 'center',
                    backgroundColor: {
                        image: weatherIcons.Cloudy
                    }
                },
                Showers: {
                    height: 40,
                    align: 'center',
                    backgroundColor: {
                        image: weatherIcons.Showers
                    }
                }
            }
        }
    }
    

提交回复
热议问题