| Page 1 of 1 | [ 5 posts ] |
|
Sorry for my nubness, but I need help. When I change the example to read months instead of years, it comes up with an error....
Code: <script type="text/javascript"> YAHOO.widget.Chart.SWFURL = "includes/yui/charts/assets/charts.swf"; //used to format x axis labels YAHOO.example.numberToCurrency = function( value ) { return YAHOO.util.Number.format(Number(value), {prefix: "$", thousandsSeparator: ","}); } //manipulating the DOM causes problems in ie, so create after window fires "load" YAHOO.util.Event.addListener(window, "load", function() { //--- data YAHOO.example.annualIncome = [ { Month: <?php echo $monthname5;?>, revenue: 1246852, expense: 1123359, income: <?php echo $totalbroker5;?> }, { Month: <?php echo $monthname4;?>, revenue: 2451876, expense: 2084952, income: <?php echo $totalbroker4;?> }, { Month: <?php echo $monthname3;?>, revenue: 2917246, expense: 2587151, income: <?php echo $totalbroker3;?> }, { Month: <?php echo $monthname2;?>, revenue: 3318185, expense: 3087456, income: <?php echo $totalbroker2;?> }, { Month: <?php echo $monthname1;?>, revenue: 3318185, expense: 3087456, income: <?php echo $totalbroker1;?> } ]; var incomeData = new YAHOO.util.DataSource( YAHOO.example.annualIncome ); incomeData.responseType = YAHOO.util.DataSource.TYPE_JSARRAY; incomeData.responseSchema = { fields: [ "Month", "revenue", "expense", "income" ] }; //--- chart var seriesDef = [ { xField: "revenue", displayName: "Revenue" }, { xField: "expense", displayName: "Expense" }, { type: "line", xField: "income", displayName: "Income" } ]; var currencyAxis = new YAHOO.widget.NumericAxis(); currencyAxis.labelFunction = "YAHOO.example.numberToCurrency"; var mychart = new YAHOO.widget.BarChart( "chart", incomeData, { series: seriesDef, yField: "Month", xAxis: currencyAxis }); //--- data table var columns = [ { key: "Month", formatter: "", sortable: true, resizeable: true }, { key: "revenue", formatter: "currency", sortable: true, resizeable: true }, { key: "expense", formatter: "currency", sortable: true, resizeable: true }, { key: "income", formatter: "currency", sortable: true, resizeable: true } ]; var mytable = new YAHOO.widget.DataTable( "datatable", columns, incomeData, { sortedBy: { key: "Month", dir: "asc" } }); }); </script> Dont Know what I have to change to make this work... |
|
Changing the example to use Month instead of year works fine for me. I suspect your issue is with your php blocks though I cannot tell without being able to see live code. Do you have a link that I can take a look at it?
Thanks, Tripp |
|
Well the IE error message shows...
Webpage error details User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0) Timestamp: Wed, 7 Sep 2011 15:15:16 UTC Message: 'September' is undefined Line: 227 Char: 3 Code: 0 URI: https://www.snapmanagerpro.com/SmartChoice/index.php |
|
Make sure Month values are strings.
Code: //this will work {Month: "September", ... //this will throw a javascript error {Month: September, ... Thanks, Tripp |
|
Damn. So simple. Thanks
|
| Page 1 of 1 | [ 5 posts ] |
| You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum |
© 2006-2013 Yahoo! Inc. All rights reserved.
All code on this site is licensed under the BSD License unless stated otherwise.
About This Site · Security Contact Info
Powered by phpBB® Forum Software © phpBB Group