GlossyCircularGaugeNeedle.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. define("dojox/gauges/GlossyCircularGaugeNeedle", ["dojo/_base/declare","dojo/_base/Color" ,"./AnalogIndicatorBase"],
  2. function(declare, Color, AnalogIndicatorBase) {
  3. /*=====
  4. AnalogIndicatorBase = dojox.gauges.AnalogIndicatorBase;
  5. =====*/
  6. return declare("dojox.gauges.GlossyCircularGaugeNeedle", [AnalogIndicatorBase], {
  7. // summary:
  8. // The needle for the dojox.gauges.GlossyCircularGauge and
  9. // dojox.gauges.GlossySemiCircularGauge.
  10. //
  11. // description:
  12. // This object defines the needle for the dojox.gauges.GlossyCircularGauge and
  13. // dojox.gauges.GlossySemiCircularGauge.
  14. // Since the needle is created by the gauges class, you do not have to use this class directly.
  15. interactionMode: "gauge",
  16. // color: String
  17. // The color of the indicator.
  18. color: '#c4c4c4',
  19. _getShapes: function(group){
  20. // summary:
  21. // Overrides AnalogIndicatorBase._getShapes
  22. var darkerColor = Color.blendColors(new Color(this.color), new Color('black'), 0.3);
  23. if (!this._gauge)
  24. return null;
  25. var shapes = [];
  26. shapes[0] = group.createGroup();
  27. var scale = Math.min((this._gauge.width / this._gauge._designWidth), (this._gauge.height / this._gauge._designHeight));
  28. shapes[0].createGroup().setTransform({
  29. xx: scale,
  30. xy: 0,
  31. yx: 0,
  32. yy: scale,
  33. dx: 0,
  34. dy: 0
  35. });
  36. shapes[0].children[0].createPath({
  37. path: "M357.1429 452.005 L333.0357 465.9233 L333.0357 438.0868 L357.1429 452.005 Z"
  38. }).setTransform({
  39. xx: 0,
  40. xy: 1,
  41. yx: -6.21481,
  42. yy: 0,
  43. dx: -452.00505,
  44. dy: 2069.75519
  45. }).setFill(this.color).setStroke({
  46. color: darkerColor,
  47. width: 1,
  48. style: "Solid",
  49. cap: "butt",
  50. join: 20.0
  51. });
  52. return shapes;
  53. }
  54. });
  55. });