Gauge D3, display values positions

↘锁芯ラ 提交于 2019-12-02 02:05:34

Its all about changing the translate for text

For example (for setting the max value of gauge):

  texts.append("text")
    .text(function() {
      return gaugeMaxValue + "%";//i added the percent(%)
    })
    .attr('id', 'scale20')
    .attr('transform', "translate(" + ((width + margin.left) / 1.08) + ", " + ((height + margin.top) / 2) + ")")//then change the x and y for the translate
    .attr("font-size", 15)
    .style("fill", "#000000");

Similarly for all other text values.

working code here

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!