function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
knicholsknichols 

Flex Help

I'm trying to format a number(revenue) being returned from my SOQL query in the datatipfunction.  I have multiple lineseries in my linechart and this is the function I'm trying to use but it only formats the number for one of the lineseries, no matter which line series my mouse is over it only shows the amount from the bottom line.  How can I get the correct value to format? 

public function myDataTipFunction(e:HitData):String
{
    var cf:CurrencyFormatter = new CurrencyFormatter();
    cf.rounding="none";
    cf.decimalSeparatorTo=".";
    cf.thousandsSeparatorTo=",";
    cf.useThousandsSeparator="true";
    cf.currencySymbol="$";
    cf.alignSymbol="left";
    cf.precision="0";
    var s:String;
    s = "<B>" + e.item.Week + "</B>\n";
    s += "<I>Amount:</I> <FONT COLOR='#339966'>";
    s += cf.format(e.item.Amount) + "</FONT>\n";       
    return s;
}
Ron HessRon Hess
not sure, but the tip function may be cached so this is only generated once.
is that possible? 
you can add debug statements to this code and then view the log to see if it's getting called with different values or called only once.
knicholsknichols
Just in case anyone else runs into this problem....I had to cast the chartItem as a lineseries so I could get to the yNumber.  If anyone knows a better solution let me know, but this works.
 

public function myDataTipFunction(e:HitData):String

{

var cf:CurrencyFormatter = new CurrencyFormatter();

var s:String;

cf.rounding="none";

cf.decimalSeparatorTo=".";

cf.thousandsSeparatorTo=",";

cf.useThousandsSeparator="true";

cf.currencySymbol="$";

cf.alignSymbol="left";

cf.precision="0";

var item:LineSeriesItem = e.chartItem as LineSeriesItem;

s = "<B>" + e.item.Week + "</B>\n";

s += "<I>Amount:</I> <FONT COLOR='#339966'>";

s += cf.format(item.yNumber) + "</FONT>\n";

return s;

}