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

Problem with chart bounds

Expand Messages
  • Dani Latorre
    Hi, I have a problem with maximum bound on a LineChart and ColumnChart, I read on documentation: By default, charts with x and y axes automatically determine
    Message 1 of 6 , May 31, 2009
    • 0 Attachment
      Hi,

      I have a problem with maximum bound on a LineChart and ColumnChart, I read
      on documentation:

      "By default, charts with x and y axes automatically determine the minimum
      and maximum values based on the data that is being displayed."

      But if I don't put the NumericAxis maxium, maximum value is 1 and lines and
      columns doesn't show completetly

      And this is my LineChart code:

                 YAHOO.widget.Chart.SWFURL =
      "http://yui.yahooapis.com/2.7.0/build/charts/assets/charts.swf";
                 var seriesDef = [
                 {
                 displayName: "Salary",
                 yField: "salary",
                 style:{borderColor:000000}
                 }
                 ];
                 YAHOO.example.formatCurrencyAxisLabel = function( value ) {
                 return YAHOO.util.Number.format( value, {
                     prefix: "€",
                     thousandsSeparator: ",",
                     decimalPlaces: 2
                 });
                 }

                 YAHOO.example.getDataTipText = function( item, index, series ) {
                         var toolTipText = "Salario de Madrid  \n";
                         toolTipText += YAHOO.example.formatCurrencyAxisLabel(
      item[series.yField] ) + " / " + item.dateText;
                         return toolTipText;
                 }

                 var currencyAxis = new YAHOO.widget.NumericAxis();
                 //currencyAxis.maximum = 80000;
                 currencyAxis.labelFunction =
      YAHOO.example.formatCurrencyAxisLabel;

           var jsonPrices
           var mychart

             jsonPrices = new YAHOO.util.DataSource(
      "/jobsket/graphs/prices/499?type=year");
             jsonPrices.connMethodPost = true;
             jsonPrices.responseType = YAHOO.util.DataSource.TYPE_JSON;
             jsonPrices.responseSchema =
             {
                     resultsList: "Results",
                     fields: ["id","salary","date","dateText"]
             };
             mychart = new YAHOO.widget.LineChart( "chart", jsonPrices, {
                 series: seriesDef,
                 xField: "dateText",
                 yAxis: currencyAxis,
                 dataTipFunction: YAHOO.example.getDataTipText,
             });

      What am I doing wrong?

      --
      Daniel Latorre
      Co-founder
      http://www.jobsket.com/

    • Dwight Bridges
      I cannot troubleshoot from this code snippet. Do you have a working test link or a live link to your data source? If not, how about a sample of what is
      Message 2 of 6 , Jun 1 10:03 AM
      • 0 Attachment
        Re: [ydn-javascript] Problem with chart bounds I cannot troubleshoot from this code snippet. Do you have a working test link or a live link to your data source? If not, how about a sample of what is returned from you data source url?

        Thanks,
        Tripp


        On 5/31/09 10:53 AM, "Dani Latorre" <danilat83@...> wrote:


          

          

        Hi,

        I have a problem with maximum bound on a LineChart and ColumnChart, I read
        on documentation:

        "By default, charts with x and y axes automatically determine the minimum
        and maximum values based on the data that is being displayed."

        But if I don't put the NumericAxis maxium, maximum value is 1 and lines and
        columns doesn't show completetly

        And this is my LineChart code:

                   YAHOO.widget.Chart.SWFURL =
        "http://yui.yahooapis.com/2.7.0/build/charts/assets/charts.swf";
                   var seriesDef = [
                   {
                   displayName: "Salary",
                   yField: "salary",
                   style:{borderColor:000000}
                   }
                   ];
                   YAHOO.example.formatCurrencyAxisLabel = function( value ) {
                   return YAHOO.util.Number.format( value, {
                       prefix: "€",
                       thousandsSeparator: ",",
                       decimalPlaces: 2
                   });
                   }

                   YAHOO.example.getDataTipText = function( item, index, series ) {
                           var toolTipText = "Salario de Madrid  \n";
                           toolTipText += YAHOO.example.formatCurrencyAxisLabel(
        item[series.yField] ) + " / " + item.dateText;
                           return toolTipText;
                   }

                   var currencyAxis = new YAHOO.widget.NumericAxis();
                   //currencyAxis.maximum = 80000;
                   currencyAxis.labelFunction =
        YAHOO.example.formatCurrencyAxisLabel;

             var jsonPrices
             var mychart

               jsonPrices = new YAHOO.util.DataSource(
        "/jobsket/graphs/prices/499?type=year");
               jsonPrices.connMethodPost = true;
               jsonPrices.responseType = YAHOO.util.DataSource.TYPE_JSON;
               jsonPrices.responseSchema =
               {
                       resultsList: "Results",
                       fields: ["id","salary","date","dateText"]
               };
               mychart = new YAHOO.widget.LineChart( "chart", jsonPrices, {
                   series: seriesDef,
                   xField: "dateText",
                   yAxis: currencyAxis,
                   dataTipFunction: YAHOO.example.getDataTipText,
               });

        What am I doing wrong?
      • Dani Latorre
        Hi Dwight, This is a sample of returned data:
        Message 3 of 6 , Jun 2 3:19 PM
        • 0 Attachment
          Hi Dwight,

          This is a sample of returned data:

          {"Results":[{"id":"0","salary":"25677.2700","date":"6","dateText":"Jun"},{"id":"1","salary":"21201.6736","date":"7","dateText":"Jul"},{"id":"2","salary":"22134.7821","date":"8","dateText":"Ago"},{"id":"3","salary":"23091.6185","date":"9","dateText":"Sep"},{"id":"4","salary":"24398.2838","date":"10","dateText":"Oct"},{"id":"5","salary":"23177.9669","date":"11","dateText":"Nov"},{"id":"6","salary":"23653.5721","date":"12","dateText":"Dic"},{"id":"7","salary":"23667.2572","date":"1","dateText":"Ene"},{"id":"8","salary":"24406.0906","date":"2","dateText":"Feb"},{"id":"9","salary":"23580.2318","date":"3","dateText":"Mar"},{"id":"10","salary":"22773.2308","date":"4","dateText":"Abr"},]}


          Thanks,

          2009/6/1 Dwight Bridges <trippb@...>


          I cannot troubleshoot from this code snippet. Do you have a working test link or a live link to your data source? If not, how about a sample of what is returned from you data source url?

          Thanks,
          Tripp




          On 5/31/09 10:53 AM, "Dani Latorre" <danilat83@...> wrote:


            

            

          Hi,

          I have a problem with maximum bound on a LineChart and ColumnChart, I read
          on documentation:

          "By default, charts with x and y axes automatically determine the minimum
          and maximum values based on the data that is being displayed."

          But if I don't put the NumericAxis maxium, maximum value is 1 and lines and
          columns doesn't show completetly

          And this is my LineChart code:

                     YAHOO.widget.Chart.SWFURL =
          "http://yui.yahooapis.com/2.7.0/build/charts/assets/charts.swf";
                     var seriesDef = [
                     {
                     displayName: "Salary",
                     yField: "salary",
                     style:{borderColor:000000}
                     }
                     ];
                     YAHOO.example.formatCurrencyAxisLabel = function( value ) {
                     return YAHOO.util.Number.format( value, {
                         prefix: "€",
                         thousandsSeparator: ",",
                         decimalPlaces: 2
                     });
                     }

                     YAHOO.example.getDataTipText = function( item, index, series ) {
                             var toolTipText = "Salario de Madrid  \n";
                             toolTipText += YAHOO.example.formatCurrencyAxisLabel(
          item[series.yField] ) + " / " + item.dateText;
                             return toolTipText;
                     }

                     var currencyAxis = new YAHOO.widget.NumericAxis();
                     //currencyAxis.maximum = 80000;
                     currencyAxis.labelFunction =
          YAHOO.example.formatCurrencyAxisLabel;

               var jsonPrices
               var mychart

                 jsonPrices = new YAHOO.util.DataSource(
          "/jobsket/graphs/prices/499?type=year");
                 jsonPrices.connMethodPost = true;
                 jsonPrices.responseType = YAHOO.util.DataSource.TYPE_JSON;
                 jsonPrices.responseSchema =
                 {
                         resultsList: "Results",
                         fields: ["id","salary","date","dateText"]
                 };
                 mychart = new YAHOO.widget.LineChart( "chart", jsonPrices, {
                     series: seriesDef,
                     xField: "dateText",
                     yAxis: currencyAxis,
                     dataTipFunction: YAHOO.example.getDataTipText,
                 });

          What am I doing wrong?



          --
          Daniel Latorre
          Co-founder
          http://www.jobsket.com/

          Independent Software Developer
          http://www.danilat.com/

        • Dwight Bridges
          Try using the DataSource number parser for the salary field in your datasource response schema. http://developer.yahoo.com/yui/datasource/#parsers Your code
          Message 4 of 6 , Jun 2 3:57 PM
          • 0 Attachment
            Re: [ydn-javascript] Problem with chart bounds Try using the DataSource number parser for the salary field in your datasource response schema.

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

            Your code would look like this.
                jsonPrices.responseSchema =
                {
                    resultsList: "Results",
                    fields:
                    [
                        "id",
                        {key:"salary", parser:"number"},
                        "date",
                        "dateText"
                    ]
                };

            That should do it. Post back if you have more issues.

            Tripp


            On 6/2/09 3:19 PM, "Dani Latorre" <danilat83@...> wrote:


              

              

            Hi Dwight,

            This is a sample of returned data:

            {"Results":[{"id":"0","salary":"25677.2700","date":"6","dateText":"Jun"},{"id":"1","salary":"21201.6736","date":"7","dateText":"Jul"},{"id":"2","salary":"22134.7821","date":"8","dateText":"Ago"},{"id":"3","salary":"23091.6185","date":"9","dateText":"Sep"},{"id":"4","salary":"24398.2838","date":"10","dateText":"Oct"},{"id":"5","salary":"23177.9669","date":"11","dateText":"Nov"},{"id":"6","salary":"23653.5721","date":"12","dateText":"Dic"},{"id":"7","salary":"23667.2572","date":"1","dateText":"Ene"},{"id":"8","salary":"24406.0906","date":"2","dateText":"Feb"},{"id":"9","salary":"23580.2318","date":"3","dateText":"Mar"},{"id":"10","salary":"22773.2308","date":"4","dateText":"Abr"},]}


            Thanks,

            2009/6/1 Dwight Bridges <trippb@...>

              

              

            I cannot troubleshoot from this code snippet. Do you have a working test link or a live link to your data source? If not, how about a sample of what is returned from you data source url?

            Thanks,
            Tripp



            On 5/31/09 10:53 AM, "Dani Latorre" <danilat83@... <http://danilat83@...> > wrote:


              

              

            Hi,

            I have a problem with maximum bound on a LineChart and ColumnChart, I read
            on documentation:

            "By default, charts with x and y axes automatically determine the minimum
            and maximum values based on the data that is being displayed."

            But if I don't put the NumericAxis maxium, maximum value is 1 and lines and
            columns doesn't show completetly

            And this is my LineChart code:

                       YAHOO.widget.Chart.SWFURL =
            "http://yui.yahooapis.com/2.7.0/build/charts/assets/charts.swf";
                       var seriesDef = [
                       {
                       displayName: "Salary",
                       yField: "salary",
                       style:{borderColor:000000}
                       }
                       ];
                       YAHOO.example.formatCurrencyAxisLabel = function( value ) {
                       return YAHOO.util.Number.format( value, {
                           prefix: "€",
                           thousandsSeparator: ",",
                           decimalPlaces: 2
                       });
                       }

                       YAHOO.example.getDataTipText = function( item, index, series ) {
                               var toolTipText = "Salario de Madrid  \n";
                               toolTipText += YAHOO.example.formatCurrencyAxisLabel(
            item[series.yField] ) + " / " + item.dateText;
                               return toolTipText;
                       }

                       var currencyAxis = new YAHOO.widget.NumericAxis();
                       //currencyAxis.maximum = 80000;
                       currencyAxis.labelFunction =
            YAHOO.example.formatCurrencyAxisLabel;

                 var jsonPrices
                 var mychart

                   jsonPrices = new YAHOO.util.DataSource(
            "/jobsket/graphs/prices/499?type=year");
                   jsonPrices.connMethodPost = true;
                   jsonPrices.responseType = YAHOO.util.DataSource.TYPE_JSON;
                   jsonPrices.responseSchema =
                   {
                           resultsList: "Results",
                           fields: ["id","salary","date","dateText"]
                   };
                   mychart = new YAHOO.widget.LineChart( "chart", jsonPrices, {
                       series: seriesDef,
                       xField: "dateText",
                       yAxis: currencyAxis,
                       dataTipFunction: YAHOO.example.getDataTipText,
                   });

            What am I doing wrong?
             
                


          • Dani Latorre
            Using the datasource number password works ok. Thanks Dwight! 2009/6/3 Dwight Bridges ... -- Daniel Latorre Co-founder
            Message 5 of 6 , Jun 3 4:39 AM
            • 0 Attachment
              Using the datasource number password works ok.

              Thanks Dwight!

              2009/6/3 Dwight Bridges <trippb@...>


              Try using the DataSource number parser for the salary field in your datasource response schema.

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

              Your code would look like this.


                  jsonPrices.responseSchema =
                  {
                      resultsList: "Results",
                      fields:
                      [
                          "id",
                          {key:"salary", parser:"number"},
                          "date",
                          "dateText"
                      ]
                  };

              That should do it. Post back if you have more issues.

              Tripp



              On 6/2/09 3:19 PM, "Dani Latorre" <danilat83@...> wrote:


                

                

              Hi Dwight,

              This is a sample of returned data:

              {"Results":[{"id":"0","salary":"25677.2700","date":"6","dateText":"Jun"},{"id":"1","salary":"21201.6736","date":"7","dateText":"Jul"},{"id":"2","salary":"22134.7821","date":"8","dateText":"Ago"},{"id":"3","salary":"23091.6185","date":"9","dateText":"Sep"},{"id":"4","salary":"24398.2838","date":"10","dateText":"Oct"},{"id":"5","salary":"23177.9669","date":"11","dateText":"Nov"},{"id":"6","salary":"23653.5721","date":"12","dateText":"Dic"},{"id":"7","salary":"23667.2572","date":"1","dateText":"Ene"},{"id":"8","salary":"24406.0906","date":"2","dateText":"Feb"},{"id":"9","salary":"23580.2318","date":"3","dateText":"Mar"},{"id":"10","salary":"22773.2308","date":"4","dateText":"Abr"},]}


              Thanks,

              2009/6/1 Dwight Bridges <trippb@...>

                

                

              I cannot troubleshoot from this code snippet. Do you have a working test link or a live link to your data source? If not, how about a sample of what is returned from you data source url?

              Thanks,
              Tripp



              On 5/31/09 10:53 AM, "Dani Latorre" <danilat83@... <http://danilat83@...> > wrote:


                

                

              Hi,

              I have a problem with maximum bound on a LineChart and ColumnChart, I read
              on documentation:

              "By default, charts with x and y axes automatically determine the minimum
              and maximum values based on the data that is being displayed."

              But if I don't put the NumericAxis maxium, maximum value is 1 and lines and
              columns doesn't show completetly

              And this is my LineChart code:

                         YAHOO.widget.Chart.SWFURL =
              "http://yui.yahooapis.com/2.7.0/build/charts/assets/charts.swf";
                         var seriesDef = [
                         {
                         displayName: "Salary",
                         yField: "salary",
                         style:{borderColor:000000}
                         }
                         ];
                         YAHOO.example.formatCurrencyAxisLabel = function( value ) {
                         return YAHOO.util.Number.format( value, {
                             prefix: "€",
                             thousandsSeparator: ",",
                             decimalPlaces: 2
                         });
                         }

                         YAHOO.example.getDataTipText = function( item, index, series ) {
                                 var toolTipText = "Salario de Madrid  \n";
                                 toolTipText += YAHOO.example.formatCurrencyAxisLabel(
              item[series.yField] ) + " / " + item.dateText;
                                 return toolTipText;
                         }

                         var currencyAxis = new YAHOO.widget.NumericAxis();
                         //currencyAxis.maximum = 80000;
                         currencyAxis.labelFunction =
              YAHOO.example.formatCurrencyAxisLabel;

                   var jsonPrices
                   var mychart

                     jsonPrices = new YAHOO.util.DataSource(
              "/jobsket/graphs/prices/499?type=year");
                     jsonPrices.connMethodPost = true;
                     jsonPrices.responseType = YAHOO.util.DataSource.TYPE_JSON;
                     jsonPrices.responseSchema =
                     {
                             resultsList: "Results",
                             fields: ["id","salary","date","dateText"]
                     };
                     mychart = new YAHOO.widget.LineChart( "chart", jsonPrices, {
                         series: seriesDef,
                         xField: "dateText",
                         yAxis: currencyAxis,
                         dataTipFunction: YAHOO.example.getDataTipText,
                     });

              What am I doing wrong?
               
                  





              --
              Daniel Latorre
              Co-founder
              http://www.jobsket.com/

              Independent Software Developer
              http://www.danilat.com/

            • Dani Latorre
              2009/6/3 Dani Latorre ... number parser :P ... -- Daniel Latorre Co-founder http://www.jobsket.com/ Independent Software Developer
              Message 6 of 6 , Jun 3 4:39 AM
              • 0 Attachment
                2009/6/3 Dani Latorre <danilat83@...>
                Using the datasource number password works ok.

                number parser :P
                 


                Thanks Dwight!

                2009/6/3 Dwight Bridges <trippb@...>



                Try using the DataSource number parser for the salary field in your datasource response schema.

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

                Your code would look like this.


                    jsonPrices.responseSchema =
                    {
                        resultsList: "Results",
                        fields:
                        [
                            "id",
                            {key:"salary", parser:"number"},
                            "date",
                            "dateText"
                        ]
                    };

                That should do it. Post back if you have more issues.

                Tripp



                On 6/2/09 3:19 PM, "Dani Latorre" <danilat83@...> wrote:


                  

                  

                Hi Dwight,

                This is a sample of returned data:

                {"Results":[{"id":"0","salary":"25677.2700","date":"6","dateText":"Jun"},{"id":"1","salary":"21201.6736","date":"7","dateText":"Jul"},{"id":"2","salary":"22134.7821","date":"8","dateText":"Ago"},{"id":"3","salary":"23091.6185","date":"9","dateText":"Sep"},{"id":"4","salary":"24398.2838","date":"10","dateText":"Oct"},{"id":"5","salary":"23177.9669","date":"11","dateText":"Nov"},{"id":"6","salary":"23653.5721","date":"12","dateText":"Dic"},{"id":"7","salary":"23667.2572","date":"1","dateText":"Ene"},{"id":"8","salary":"24406.0906","date":"2","dateText":"Feb"},{"id":"9","salary":"23580.2318","date":"3","dateText":"Mar"},{"id":"10","salary":"22773.2308","date":"4","dateText":"Abr"},]}


                Thanks,

                2009/6/1 Dwight Bridges <trippb@...>

                  

                  

                I cannot troubleshoot from this code snippet. Do you have a working test link or a live link to your data source? If not, how about a sample of what is returned from you data source url?

                Thanks,
                Tripp



                On 5/31/09 10:53 AM, "Dani Latorre" <danilat83@... <http://danilat83@...> > wrote:


                  

                  

                Hi,

                I have a problem with maximum bound on a LineChart and ColumnChart, I read
                on documentation:

                "By default, charts with x and y axes automatically determine the minimum
                and maximum values based on the data that is being displayed."

                But if I don't put the NumericAxis maxium, maximum value is 1 and lines and
                columns doesn't show completetly

                And this is my LineChart code:

                           YAHOO.widget.Chart.SWFURL =
                "http://yui.yahooapis.com/2.7.0/build/charts/assets/charts.swf";
                           var seriesDef = [
                           {
                           displayName: "Salary",
                           yField: "salary",
                           style:{borderColor:000000}
                           }
                           ];
                           YAHOO.example.formatCurrencyAxisLabel = function( value ) {
                           return YAHOO.util.Number.format( value, {
                               prefix: "€",
                               thousandsSeparator: ",",
                               decimalPlaces: 2
                           });
                           }

                           YAHOO.example.getDataTipText = function( item, index, series ) {
                                   var toolTipText = "Salario de Madrid  \n";
                                   toolTipText += YAHOO.example.formatCurrencyAxisLabel(
                item[series.yField] ) + " / " + item.dateText;
                                   return toolTipText;
                           }

                           var currencyAxis = new YAHOO.widget.NumericAxis();
                           //currencyAxis.maximum = 80000;
                           currencyAxis.labelFunction =
                YAHOO.example.formatCurrencyAxisLabel;

                     var jsonPrices
                     var mychart

                       jsonPrices = new YAHOO.util.DataSource(
                "/jobsket/graphs/prices/499?type=year");
                       jsonPrices.connMethodPost = true;
                       jsonPrices.responseType = YAHOO.util.DataSource.TYPE_JSON;
                       jsonPrices.responseSchema =
                       {
                               resultsList: "Results",
                               fields: ["id","salary","date","dateText"]
                       };
                       mychart = new YAHOO.widget.LineChart( "chart", jsonPrices, {
                           series: seriesDef,
                           xField: "dateText",
                           yAxis: currencyAxis,
                           dataTipFunction: YAHOO.example.getDataTipText,
                       });

                What am I doing wrong?
                 
                    





                --
                Daniel Latorre
                Co-founder
                http://www.jobsket.com/

                Independent Software Developer
                http://www.danilat.com/




                --
                Daniel Latorre
                Co-founder
                http://www.jobsket.com/

                Independent Software Developer
                http://www.danilat.com/

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