canvassvgdojodojox.gfx

Is it possible (how) to define custom stroke styles for dojox.gfx lines?


According to dojo documentation, lines in dojox.gfx support a number of stroke styles:

“Solid” “ShortDash” “ShortDot” “ShortDashDot” “ShortDashDotDot” “Dot” “Dash” “LongDash” “DashDot” “LongDashDot” “LongDashDotDot” “none”

  1. Am I limited to these combinations?
  2. Is it possible to create custom styles by defining a line/dot pattern?
  3. Is it possible to define the scale of the pattern or the unit length?

Thanks!


Solution

  • Dojo is a cross platform API and on IE8 and below it generates VML, elsewhere (e.g. IE9+) it generates SVG.

    1. Microsoft's VML is limited to these combinations and therefore, to work cross-platform so is dojo.
    2. You could work around this by generating custom SVG stroke styles directly but they wouldn't work on IE8 and below.
    3. Not with VML, it is possible with native SVG though.

    e.g.

    <line stroke-dasharray="5, 5"/>
    <line stroke-dasharray="15, 15"/>