Note that there are some explanatory texts on larger screens.

plurals
  1. POFlex: Create custom stroke on LineSeries?
    primarykey
    data
    text
    <p>You can easily set a stroke on a line series like this:</p> <pre><code>&lt;mx:LineSeries yField="apple"&gt; &lt;mx:lineStroke&gt; &lt;mx:Stroke color="0x6699FF" weight="4" alpha=".8" /&gt; &lt;/mx:lineStroke&gt; &lt;/mx:LineSeries&gt; </code></pre> <p>This will set alpha for the entire stroke to .8</p> <p>But I want to be able to set a different alpha on the stoke for each plot based on something in the dataProvider.</p> <p>For example the <code>yField</code> in the lineSeries is "Apple" which is how it knows where to plot for the lineSeries. I want to be able to add something like <code>alphaField</code> which tells it what to set the stroke alpha for each plot.</p> <p>so if my dataProvider was:</p> <pre><code>&lt;result month="Jan-04"&gt; &lt;apple&gt;81768&lt;/apple&gt; &lt;alpha&gt;1&lt;/alpha&gt; &lt;/result&gt; &lt;result month="Feb-04"&gt; &lt;apple&gt;51156&lt;/apple&gt; &lt;alpha&gt;1&lt;/alpha&gt; &lt;/result&gt; &lt;result month="Mar-04"&gt; &lt;apple&gt;51156&lt;/apple&gt; &lt;alpha&gt;.5&lt;/alpha&gt; &lt;/result&gt; </code></pre> <p>And I set <code>alphaField="alpha"</code> then I would have a solid stroke from plot 0 to plot 1 and then a 50% alpha stroke from plot 1 to plot 2.</p> <p>How can I do this??? I am looking in the commitProperties() and updateDisplayList() methods of LineSeries and have no idea what would need to be added/changed to make this?</p> <p>I am pretty sure, this class has to use Graphics.lineTo() to draw each plot, so basically it would need to "get" the current alphaField value somehow, and apply a Graphics.lineStyle() with the correct alpha before drawing each line. </p> <p>Thanks!!</p> <hr> <p><strong>UPDATE</strong></p> <p>I have gotten much closer to my answer.</p> <p>When I extend LineRenderer I override updateDisplayList() which calls GraphicsUtilities.drawPolyLine()</p> <p>I extend GraphicsUtilities and override the method drawPolyLine() as this is where the line is actually drawn.</p> <p>I can call lineStyle() in here and change the alpha of the line...</p> <p><strong>I still have 1 thing I cannot figure out, from within the drawPolyLine() method how can I access that data that dictates what the alpha should be?</strong></p> <p>Thanks!!!!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload