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

how to attach callback to datasource used by chart?

Expand Messages
  • grimholtz
    Hi, I have a chart with a polling datasource. Since the chart calls sendRequest() on the datasource internally, I have no option to attach a callback handler
    Message 1 of 2 , Jul 1, 2008
    • 0 Attachment
      Hi,

      I have a chart with a polling datasource. Since the chart calls
      sendRequest() on the datasource internally, I have no option to attach
      a callback handler (and I wouldn't want to overwrite the chart's
      callback handler, anyway). What's the best way to get notified of new
      data from the datasource in this situation?

      YAHOO.widget.Chart.SWFURL = "/foobar/charts.swf";
      var ds = new YAHOO.util.DataSource("/foobar/datasource1.seam");
      ds.responseType = YAHOO.util.DataSource.TYPE_JSON;
      ds.responseSchema = {resultsList: "response.results", fields:
      ["label", "value", "tooltip"], timestamp: "response.timestamp"};

      var chart = new YAHOO.widget.LineChart("chartdiv", ds, {
      xField: "label", yField: "value", polling: 5000, dataTipFunction:
      getDataTip, version: "9.0.115" /* required for when chart is in a
      <form/>. */
      });

      Thanks,
      Eric
    • Satyam
      See: http://developer.yahoo.com/yui/datasource/#events Satyam
      Message 2 of 2 , Jul 1, 2008
      • 0 Attachment
        See:

        http://developer.yahoo.com/yui/datasource/#events

        Satyam

        grimholtz wrote:
        > Hi,
        >
        > I have a chart with a polling datasource. Since the chart calls
        > sendRequest() on the datasource internally, I have no option to attach
        > a callback handler (and I wouldn't want to overwrite the chart's
        > callback handler, anyway). What's the best way to get notified of new
        > data from the datasource in this situation?
        >
        > YAHOO.widget.Chart.SWFURL = "/foobar/charts.swf";
        > var ds = new YAHOO.util.DataSource("/foobar/datasource1.seam");
        > ds.responseType = YAHOO.util.DataSource.TYPE_JSON;
        > ds.responseSchema = {resultsList: "response.results", fields:
        > ["label", "value", "tooltip"], timestamp: "response.timestamp"};
        >
        > var chart = new YAHOO.widget.LineChart("chartdiv", ds, {
        > xField: "label", yField: "value", polling: 5000, dataTipFunction:
        > getDataTip, version: "9.0.115" /* required for when chart is in a
        > <form/>. */
        > });
        >
        > Thanks,
        > Eric
        >
        >
        >
        >
        > ------------------------------------
        >
        > Yahoo! Groups Links
        >
        >
        >
        > ------------------------------------------------------------------------
        >
        >
        > No virus found in this incoming message.
        > Checked by AVG.
        > Version: 8.0.101 / Virus Database: 270.4.3/1526 - Release Date: 30/06/2008 8:43
        >
      Your message has been successfully submitted and would be delivered to recipients shortly.