12063

RectangularRangeIndicator format like triangular using dojo

I'm trying to add an indicator to my vertical gauge but the format of the indicator is like a triangle, but I want it a large line.

This is JSFIDDLE example.

The code :

require(['dojo/parser', 'dojox/dgauges/components/default/VerticalLinearGauge','dojox/dgauges/RectangularRangeIndicator', 'dojo/domReady!'], function (parser, VerticalLinearGauge) { parser.parse(); var ri = new dojox.dgauges.RectangularRangeIndicator(); ri.set("start",0 ); ri.set("value", 30); ri.set("startThickness",100); ri.set("endThickness",100); gauge.getElement("scale").addIndicator("ri", ri, false); });

Answer1:

This is a bug, it will be fixed in next releases (1.8.x and 1.9).

See https://github.com/dmandrioli/dgauges/issues/15

As a workaround, you can redefine the bad method like this:

myRangeIndicator._defaultVerticalShapeFunc = function(indicator, group, scale, startX, startY, endPosition, startThickness, endThickness, fill, stroke){ ... }

See this workaround in action at http://jsfiddle.net/BFPuL/5/

Answer2:

I think that the properties are startThickness and endThickness (no "stroke" at the end). However, I still don't get one solid line when setting these properties to equal values like one would expect. It seems as though something odd (perhaps a bug) is happening with the way that the startThickness property is handled.

This problem has me interested, so I'll try to set aside some time later to dig into the source to see what the real issue is, but for now I can offer you a dirty workaround. The RectangularRangeIndicator is drawn using the dojox/gfx module, and the outline of the indicator drawn is controlled by the stroke property. So, if you want, you can do something like:

var ri = new dojox.dgauges.RectangularRangeIndicator(); ri.set("start",0 ); ri.set("value", 30); ri.set("startThickness", 0); ri.set("endThickness", 0); ri.set("stroke", {color: "red", width: 2.5}); ri.set("paddingLeft", 7); // Default is 10, set this to whatever works for you.

This will appear to draw straight line (which is really the border of an extremely thin shape). Check out how it looks in a real example. Again, I understand that this is not the best solution since it is more of a dirty trick, but it is a way around what appears to be a bug in the code that renders a range indicator.

Recommend

  • GWT composite widget
  • Failed to generate scripts for Sql Azure database: “Getting the list of objects from : failed”
  • IE6 textBox.focus(); causing “Unexpected call to method or property access”
  • java - inserting text using JTextArea by number line
  • Stanford-parser in Ruby does not create Preprocesser
  • 500 internal server error in ruby on rails
  • What is the official release update URL for Aptana Studio 3.0?
  • An unexpected error has been detected by HotSpot Virtual Machine
  • iPhone - UIWebView multiple locks
  • How to get to older Xcode beta version?
  • Safari PHP form submission -file upload hangs
  • Fixed Background Works in Chrome but Not Firefox?
  • scrollOverflow not working in fullPage.js
  • 3.0.0.M1: SSL - Invalid keystore format
  • RabbitMQ java client stops consuming messages
  • Backward compatibility of Python 3.5 for external modules
  • Reading space separated values file in c++ error
  • apply a javascript function to draggable copy
  • Possible to get mouse events fired when cursor is outside page?
  • Filter strings with regex before casting to numeric
  • Using JRuby with Rails 3.2
  • How to have background script and something similar to a default popup?
  • d3 v4 drag and drop with TypeScript
  • $wpdb not working in file of WordPress plugin
  • Is it possible to access block's scope in method?
  • Installing Hadoop, Java Exception about illegal characters at index 7?
  • jQuery show() function is not executed in Safari if submit handler returns true
  • DotNetZip - Calculate final zip size before calling Save(stream)
  • Possible to stop flickering java tooltip in heavyweight mode?
  • Cross-Platform Protobuf Serialization
  • How to model a transition system with SPIN
  • InvalidAuthenticityToken between subdomains when logging in with Rails app
  • Revoking OAuth Access Token Results in 404 Not Found
  • Cant find why the layout is getting smaller
  • How to stop GridView from loading again when I press back button?
  • Bitwise OR returns boolean when one of operands is nil
  • sending mail using smtp is too slow
  • XCode 8, some methods disappeared ? ex: layoutAttributesClass() -> AnyClass
  • costura.fody for a dll that references another dll
  • Binding checkboxes to object values in AngularJs