Note that there are some explanatory texts on larger screens.

plurals
  1. POFlex: Positioning Plot Series item
    text
    copied!<p>I have a chart with multiple series (Area and Plot). The Area series has 'xField' as 'timeStamp' and 'yField' as 'price'. The Plot Series has 'xField' as 'timeStamp' and no 'yField'.... ! Can I position the plot series though I do not have a corresponding 'yField' value ? Can I assign a default value to the 'yField' (say '10' for all...?) </p> <p>This is how I create my AreaChart initially. At this point, I have no idea whether to render events or not, so I do not attempt to create a 'plot series' at this point. </p> <pre><code> //Note: 'AreaSeries' and 'PlotSeries' have different dataproviders var areaChart:AreaChart = new AreaChart(); areaChart.width = width; areaChart.height = height; areaChart.showDataTips = true; var vAxis:LinearAxis = new LinearAxis(); if(vAxisLblFunction != null){ vAxis.labelFunction = vAxisLblFunction; areaChart.verticalAxis = vAxis; } var hAxis:CategoryAxis = new CategoryAxis(); hAxis.categoryField = "timeStamp"; areaChart.horizontalAxis = hAxis; areaChart.horizontalAxisRenderer = createHAxisRenderer(hAxis); var areaChartSeries:AreaSeries = new AreaSeries(); areaChartSeries.yField = "price"; areaChartSeries.displayName = "Stock Price"; areaChartSeries.setStyle("form", "segment"); var chartStroke:Stroke = new Stroke(); chartStroke.color = 0xFF0000; chartStroke.weight = CHART_STROKE_WEIGHT; var chartColor:SolidColor = new SolidColor(); chartColor.alpha = CHART_ALPHA; chartColor.color = 0x000000; areaChartSeries.setStyle("areaStroke", chartStroke); areaChartSeries.setStyle("areaFill", chartColor); chartSeriesArr.push(areaChartSeries); </code></pre> <p>Now, during run-time I want to plot some events as required.</p> <pre><code>var evtSer:PlotSeries = new PlotSeries(); evtSer.dataProvider = devEventsAC; //Assume that I get the 'eventsDataProvider' somehow at run-time evtSer.xField = "timeStamp"; //Notice there is no 'yField' to map here. //evtSer.dataFunction = eventSerDataFunc; //Tried with a 'dataFunction' assigning default value of '10' to the 'yField' var fillColor:SolidColor = new SolidColor(); fillColor.color = 0xA933DC; fillColor.alpha = 0.8; evtSer.setStyle("fill", fillColor); var strokeColor:SolidColorStroke = new SolidColorStroke(); strokeColor.color = 0x9494B8; strokeColor.weight = 1; evtSer.setStyle("stroke", strokeColor); var chartSeriesArr:Array = trendPanel.areaChart.series; chartSeriesArr.push(evtSer); trendPanel.areaChart.series = chartSeriesArr; </code></pre> <p>So, my problem is that how do I plot the 'events' without a 'yField'. Is there a way to assign 'yField' value using the series's 'dataFunction' ?</p> <p>Here is my thought:</p> <ol> <li>In the 'dataFunction' we get a reference to the 'series' object. Using the series object get the 'parent' which is the chart and then get the series array for that chart.</li> <li>Now, get the 'yField' value fron the 'AreaSeries' and return it as the 'yField' value for the 'plot series'.</li> <li>But, if I have multiple events with same 'yField' value there is a very good chance that all the events plotted top of each other. (First I am not sure whether 1 &amp; 2 works here...)</li> </ol> <p>Second approach is using the 'CartesianDataCanvas'. Again, here it requires datapoints (x,y) which I don't have. </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