Well, we use pretty standard string sorting functions for sorting by 
string. So, if you're seeing performance you don't like, you're going to 
need to specify your own. You can do this with Sergey's trick, by 
specifying the sort order you want when you specify the address. For 
example:


http://jsfiddle.net/Shrf9/

If you see that I specify the sort order for Alice,Bob,Jim,Mike. If you 
compare this performance to the standard sorting order:

http://jsfiddle.net/z623S/

You can see what I'm talking about.

Hope that helps.




On Friday, May 2, 2014 10:59:05 PM UTC-4, Todd Lee wrote:
>
> I just realized that the sorting of the address is messed up to.  I get 
> that its a string and a number.  But I can't seem to figure out the proper 
> syntax.
> Any suggestions?
>
> On Friday, May 2, 2014 2:44:03 PM UTC-4, Todd Lee 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 [email protected].
To post to this group, send email to [email protected].
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