Loading ...
Sorry, an error occurred while loading the content.

Re: bug with customizing chart axis labels?

Expand Messages
  • tripp.bridges
    ... customizing a ... NumericAxis may ... it s passed ... this line ... called, as ... successfully, ... Hi, For now, continue to specify you label functions
    Message 1 of 2 , Sep 2, 2008
    • 0 Attachment
      --- In ydn-javascript@yahoogroups.com, "Todd Wells" <ttopwells@...> wrote:
      >
      > I just spent a while trying to figure this out, the docs for
      customizing a
      > chart's axis label says that the labelFunction property of a
      NumericAxis may
      > be passed by name or function reference. I see an example where
      it's passed
      > by reference, but for the life of me, my usage only works if I pass
      by name:
      >
      > function formatPct(value) {
      > return YAHOO.util.Number.format(value, {
      > decimalPlaces: 2,
      > suffix: "%"
      > });
      > }
      >
      > function drawLineChart() {
      > var successRateAxis = new YAHOO.widget.NumericAxis();
      > successRateAxis.maximum = 100;
      > successRateAxis.labelFunction = "formatPct"; // <------
      this line
      >
      > var myChart = new YAHOO.widget.LineChart( "lineChart",
      > getLineChartDataSource(),
      > {
      > xField: "dateExecuted",
      > yField: "successRate",
      > yAxis: successRateAxis
      > });
      > }
      >
      > In the above example, if I change the indicated line to
      >
      > successRateAxis.labelFunction = formatPct;
      >
      > then my chart labels are *not* customized (the function is never
      called, as
      > far as my debugger indicates).
      > Interestingly, I can see one of the Chart examples doing this
      successfully,
      > so I'm not sure why my example here doesn't work correctly.
      >
      Hi,
      For now, continue to specify you label functions by name. I will post
      back when I discover why passing the function by reference has
      inconsistent results.

      Thanks,
      Tripp
    Your message has been successfully submitted and would be delivered to recipients shortly.