bernii / gauge.js

100% native and cool looking JavaScript gauge
MIT License
1.42k stars 391 forks source link

Gauge doesn't hit max when exceeding maxValue #139

Closed marcantonio closed 7 years ago

marcantonio commented 7 years ago
      var opts = {
          angle: 0.35,
          lineWidth: 0.15,
          radiusScale: 1,
          pointer: {
              length: 0.6,
              strokeWidth: 0.035,
              color: '#000000'
          },
          limitMax: false,
          limitMin: false,
          colorStart: '#C0C0DB',
          colorStop: '#33C3F0',
          strokeColor: '#EEEEEE',
          generateGradient: true,
          highDpiSupport: true
      };
      var target = document.getElementById('canvas-gauge');
      var gauge = new Donut(target).setOptions(opts);
      gauge.minValue = 0;
      gauge.maxValue = 800;
      gauge.setTextField(document.getElementById('gauge-textfield'));
      gauge.animationSpeed = 8;
      gauge.set(850);

screen shot 2017-06-27 at 10 17 18 am

kplindegaard commented 7 years ago

Behavior used to be that the max values would be increased by 10% if the input exceeded maxValue.

Recently the limitMax flag was introduced to prevent this for Gauge, but I don't remember if anyone ported that across to Donut...? Anyhow, you should set the limitMax options flag to true just for the record. If the maxValue is still automatically increased (you could try to print it to the console to see for yourself as well), there is an issue.

marcantonio commented 7 years ago

maxValue is still increased.

marcantonio commented 7 years ago

Fixed here: https://github.com/bernii/gauge.js/pull/140