BarCircleIndicator.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. define("dojox/gauges/BarCircleIndicator", ["dojo/_base/declare","dojox/gfx","./BarLineIndicator"],
  2. function(declare, gfx, BarLineIndicator) {
  3. /*=====
  4. BarLineIndicator = dojox.gauges.BarLineIndicator;
  5. =====*/
  6. return declare("dojox.gauges.BarCircleIndicator", [BarLineIndicator], {
  7. // summary:
  8. // An indicator for the BarGauge that draws a circle at a position that corresponds to the
  9. // indicator value. This indicator is mainly used to draw round ticks for the scale.
  10. _getShapes: function(group){
  11. // summary:
  12. // Override of dojox.gauges.BarLineIndicator._getShapes
  13. var color = this.color ? this.color : 'black';
  14. var strokeColor = this.strokeColor ? this.strokeColor : color;
  15. var stroke = {
  16. color: strokeColor,
  17. width: 1
  18. };
  19. if (this.color.type && !this.strokeColor){
  20. stroke.color = this.color.colors[0].color;
  21. }
  22. var y = this._gauge.dataY + this.offset + this.length / 2;
  23. var v = this.value;
  24. if (v < this._gauge.min){
  25. v = this._gauge.min;
  26. }
  27. if (v > this._gauge.max){
  28. v = this._gauge.max;
  29. }
  30. var pos = this._gauge._getPosition(v);
  31. var shapes = [group.createCircle({
  32. cx: 0,
  33. cy: y,
  34. r: this.length / 2
  35. }).setFill(color).setStroke(stroke)];
  36. shapes[0].setTransform(gfx.matrix.translate(pos, 0));
  37. return shapes;
  38. }
  39. });
  40. });