Britechart-如何将图标图像添加到图表y轴

问题描述 投票:0回答:1

我正在将Vue与Britecharts一起使用,并且创建了水平条形图,然后将头像图像添加到名称标签右侧的Yas上。我进行了一些研究,发现D3 How to place image next to horizontal line textthis确实完成了我想实现的目标,但在D3中。

我想知道如何在Britecharts中做同样的事情。下面是我的示例代码。

Codepen: https://codepen.io/cooltaiwanesesam/pen/RwPYpbz

createHorizontalBarChart() {
    let barChart = new britecharts.bar(),
        margin = {left: 120, right: 20, top: 20, bottom: 30},
        barContainer = d3.select('.js-horizontal-bar-chart-container'),
        containerWidth = barContainer.node() ? barContainer.node().getBoundingClientRect().width : false;

    barChart
       .isHorizontal(true)
       .margin(margin)
       .width(containerWidth)
       .colorSchema(britecharts.colors.colorSchemas.britecharts)
       .valueLabel('percentage')
       .height(300);

    barContainer.datum(this.data.reverse()).call(barChart); 
}
javascript vue.js d3.js charts
1个回答
0
投票

问题已解决。共享代码以帮助有需要的人。

© www.soinside.com 2019 - 2024. All rights reserved.