Note that there are some explanatory texts on larger screens.

plurals
  1. POFlex Charts: Can you use a minimum/maximum point from an IAxis for Cartesian Data Canvas to draw the entire width of the chart?
    text
    copied!<p>I have a chart with a DateTime axis as my horizontal and a Linear Axis for my vertical inside a Adobe Flex Line Chart. I want to use a Cartesian Data Canvas as a background element and draw custom set of background graphics mostly rectangles. When I have more than a single data point, the graphics work perfectly since they are supposed to span the width of the entire chart.</p> <p>When I have only a single data point, however, I can't seem to get the rectangles to draw. Since I want my rectangles to span the entire width of the chart, I was thinking that I could get the x-coordinates from my axis, but this isn't working. </p> <pre><code>var canvasWidth:Number = chtCanvas.width; var canvasHeight:Number = chtCanvas.height; var minPt:Array; var maxPt:Array; var minPtDate:Date; var maxPtDate:Date; var minPtComplete:Point; var maxPtComplete:Point; // This works fine when there is more than 1 data point minPt = chtCanvas.localToData(new Point(0, 0)); maxPt = chtCanvas.localToData(new Point(canvasWidth,canvasHeight)); //This does return a date object, but wont draw below minPtDate = axisDate.minimum; maxPtDate = axisDate.maximum; //This returns NaN for the x minPtComplete = chtCanvas.dataToLocal(minPtDate, axisSalary.minimum); maxPtComplete = chtCanvas.dataToLocal(maxPtDate, axisSalary.maximum); // Also tried this. Also returns NaN for the x value //minPtComplete = chtCanvas.dataToLocal(axisDate.minimum, axisSalary.minumum); //maxPtComplete = chtCanvas.dataToLocal(axisDate.maximum, axisSalary.maximum); </code></pre> <p>My actual drawing method is as follows:</p> <pre><code>// Tried this, works with points &gt;2, does not draw with single data point chtCanvas.drawRect(minPt[0], detail[i].MaxValue, maxPt[0], detail[i].MinValue); //tried this, no effect with single point //chtCanvas.drawRect(minPtDate, detail[i].MaxValue, maxPtDate, detail[i].MinValue); // Tried this, no effect with single point //chtCanvas.drawRect(minPtDate, minPt[1], maxPtDate, detail[i].MinValue); // Tried this also //chtCanvas.drawRect(minPtComplete.x, detail[i].MaxValue, maxPtComplete.x, detail[i].MinValue); </code></pre> <p>In this example, detail is an array collection of salary values and Im using the data value in the array to determine the vertical bounds of my rectangles.</p> <p>I need to draw the rectangles the entire width of the chart (even when there is only a single data point). Thanks</p>
 

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