It looks like your issue is that all your columns are strings, so the table
sorts them as strings. You need to make it clearer to arrayToDataTable that
they are in fact numbers and that the strings are simply for the display.
You can do that by specifying an object instead of a string, like {v: 850,
f: '<center>850</center>'}. If you fix all your values, that should help.

On Fri May 02 2014 at 2:44:07 PM, Todd Lee <toddm...@gmail.com> wrote:

> I've used the goolge api to create a pretty sweet chart.  You can find it
> here:  http://http://www.bramptoncondoliving.ca/index.php?p=665
>
> Here is the problem.  The chart messes up the numbers over 1000.  ie it
> should show order up or down like this 100, 200, ...900, 1000  instead is
> does 100, 1000, 1100...800,900.
> Here is the code that I'm using:
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "
> http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
> <html xmlns="http://www.w3.org/1999/xhtml";>
> <head>
>   <meta http-equiv="content-type" content="text/html; charset=utf-8" />
>   <title>Google Visualization API Sample</title>
>   <script type="text/javascript" src="http://www.google.com/jsapi
> "></script>
>   <script type="text/javascript">
>     google.load('visualization', '1', {packages: ['table']});
>     function drawVisualization() {
>       // Create and populate the data table.
>       var data = google.visualization.arrayToDataTable([
>         ['<b><center>Address</center></b>',
> '<b><center>Website</center></b>',
> '<b><center>Condo</center></b>','<b><center>Neighborhood</center></b>',
> '<b><center>Year</center></b>','<b><center>Floors</center></b>','<b><center>Starting
> Sq.Ft.</center></b>','<b><center>Starting
> Price</center></b>','<b><center>Starting
> Fee</center></b>','<b><center>Water</center></b>','<b><center>Hydro</center></b>',
> '<b><center>Starting Rent</center></b>'],
>
> ['<center>20 Cherrytree Dr East</center>', '/mississauga-condos-for-rent',
> '<center>Crown West Condo</center>','<center>Fletchers Creek
> South</center>','<center>1988</center>',
> '<center>16</center>','<center>950</center>','<center>$176,500</center>','<center>$661</center>','<center>YES</center>','<center>YES</center>','<center>$1,450</center>'],
>
> ['<center>58 Church St East</center>', '/mississauga-condos-for-rent',
> '<center>Hallmark Place Condo</center>','<center>Downtown
> Brampton</center>','<center>NA</center>',
> '<center>13</center>','<center>1,450</center>','<center>$300,000</center>','<center>$640</center>','<center>YES</center>','<center>YES</center>','<center>$1,500</center>'],
>
> ['<center>100 County Court</center>', '/mississauga-condos-for-rent',
> '<center>Crown East Condo</center>','<center>Fletchers Creek
> South</center>','<center>1987</center>',
> '<center>20</center>','<center>1,100</center>','<center>$205,000</center>','<center>$638</center>','<center>YES</center>','<center>YES</center>','<center>$1,500</center>'],
>
>
> ['<center>9 George St North</center>', '/mississauga-condos-for-rent',
> '<center>Renaissance Condo</center>','<center>Downtown
> Brampton</center>','<center>2011</center>',
> '<center>27</center>','<center>650</center>','<center>$200,000</center>','<center>$257</center>','<center>YES</center>','<center>NO</center>','<center>$1,100</center>'],
>
>
> ['<center>22 Hanover Rd</center>', '/mississauga-condos-for-rent',
> '<center>Bellaire On The Park 2 Condo</center>','<center>Queen Street
> Corridor</center>','<center>1990</center>',
> '<center>24</center>','<center>750</center>','<center>$182,000</center>','<center>$381</center>','<center>YES</center>','<center>YES</center>','<center>$1350</center>'],
>
> ['<center>24 Hanover Rd</center>', '/mississauga-condos-for-rent',
> '<center>Bellair On The Park 3 Condo</center>','<center>Queen Street
> Corridor</center>','<center>1990</center>',
> '<center>22</center>','<center>750</center>','<center>$172,000</center>','<center>$402</center>','<center>YES</center>','<center>YES</center>','<center>$1,300</center>'],
>
> ['<center>26 Hanover Rd</center>', '/mississauga-condos-for-rent',
> '<center>Bellair On The Park 1 Condo</center>','<center>Queen Street
> Corridor</center>','<center>1988</center>',
> '<center>16</center>','<center>850</center>','<center>$165,000</center>','<center>$430</center>','<center>YES</center>','<center>YES</center>','<center>$1,200</center>'],
>
> ['<center>100 John St</center>', '/mississauga-condos-for-rent',
> '<center>NA</center>','<center>Downtown
> Brmapton</center>','<center>2011</center>',
> '<center>27</center>','<center>650</center>','<center>$220,000</center>','<center>$260</center>','<center>NO</center>','<center>NO</center>','<center>$1,200</center>'],
>
> ['<center>25 Kensington Rd</center>', '/mississauga-condos-for-rent',
> '<center>Kensington Towers 2</center>','<center>Queen Stree
> Corridor</center>','<center>1975</center>',
> '<center>18</center>','<center>950</center>','<center>$155,000</center>','<center>$392</center>','<center>YES</center>','<center>NO</center>','<center>$1,275</center>'],
>
>       ]);
>
>       // Create and draw the visualization.
>       var table = new
> google.visualization.Table(document.getElementById('visualization'));
>
>       var formatter = new google.visualization.TablePatternFormat('<a
> href={1}>{0}</a>');
>       formatter.format(data, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]); //
> Apply formatter and set the formatted value of the first column.
>
>       var view = new google.visualization.DataView(data);
>       view.setColumns([0,2,3,4,5,6,7,8,9,10, 11]); // Create a view with
> the first column only.
>
>       table.draw(view, {allowHtml: true, showRowNumber: false});
>     }
>
>     google.setOnLoadCallback(drawVisualization);
>   </script>
> </head>
> <body style="font-family: Arial;border: 0 none;">
> <div id="visualization" style="width: 940px; height: 400px;"></div>
> </body>
> </html>
>
>
> Please how do I get it to sort properly?
>
> Thanks
> Todd
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Visualization API" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to google-visualization-api+unsubscr...@googlegroups.com.
> To post to this group, send email to
> google-visualization-api@googlegroups.com.
> Visit this group at
> http://groups.google.com/group/google-visualization-api.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-visualization-api+unsubscr...@googlegroups.com.
To post to this group, send email to google-visualization-api@googlegroups.com.
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/d/optout.

Reply via email to