Skip to content Skip to sidebar Skip to footer

Gauge D3, Display Values Positions

I'm trying to use some ready written javascript to make gauge. I'm almost there, but i cannot figure how to manage value captions. Here is how my code works now: And this is how

Solution 1:

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

Post a Comment for "Gauge D3, Display Values Positions"