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

Re: Parse fields in Data Source for Line Chart

Expand Messages
  • Arun Gupta
    Thanks! Can it be made as a TimeAxis and 8:54 treated as mm:ss instead ? Or may be 00:08:54 ? -Arun
    Message 1 of 3 , Jul 24, 2009
    • 0 Attachment
      Thanks!

      Can it be made as a TimeAxis and "8:54" treated as "mm:ss" instead ?

      Or may be 00:08:54 ?

      -Arun

      --- In ydn-javascript@yahoogroups.com, Dwight Bridges <trippb@...> wrote:
      >
      > The NumericAxis cannot parse values like ³8:54². You will need to parse the
      > values before passing them to the chart.
      >
      > Tripp
      >
      >
      > On 7/21/09 5:20 PM, "Arun Gupta" <arun.gupta@...> wrote:
      >
      > >
      > >
      > >
      > >
      > > Here is JavaScript excerpt that plots a LineChart correctly:
      > >
      > > -- cut here --
      > > runlogs =
      > > [
      > > { date: "2009/01/01", distance: 10.00, pace: 8.54 },
      > > { date: "2009/01/02", distance: 9.00, pace: 7.55 },
      > > { date: "2009/01/03", distance: 5.00, pace: 7.20 },
      > > { date: "2009/01/04", distance: 10.00, pace: 7.44 }
      > > ];
      > >
      > > var myDataSource = new YAHOO.util.DataSource( runlogs );
      > > myDataSource.responseSchema =
      > > {
      > > fields: [ "date", "distance", "pace" ]
      > > };
      > >
      > > var seriesDef =
      > > [
      > > { displayName: "Pace", yField: "pace" }
      > > ];
      > >
      > > YAHOO.util.Event.onAvailable('chart', function() {
      > > new YAHOO.widget.LineChart( "chart", myDataSource,
      > > {
      > > series: seriesDef,
      > > xField: "date"
      > > });
      > > }, this);
      > > -- cut here --
      > >
      > > But my real data source spits data as:
      > >
      > > runlogs =
      > > [
      > > { date: "2009/01/01", distance: 10.00, pace: "8:54" },
      > > { date: "2009/01/02", distance: 9.00, pace: "7:55" },
      > > { date: "2009/01/03", distance: 5.00, pace: "7:20" },
      > > { date: "2009/01/04", distance: 10.00, pace: "7:44" }
      > > ];
      > >
      > > However the chart cannot be plotted with this data, basically the Y-Axis is
      > > plotted with 0, .5 and 1 values. Is there a mechanism to parse the "pace"
      > > field which can then be used by the Charts library to create the BarChart
      > > correctly ?
      > >
      > > -Arun
      > >
      > >
      > >
      > >
      > >>
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.