Browse files

Merge branch 'master' of github.com:misoproject/dataset into release-0.3

  • Loading branch information...
2 parents a532ae7 + c6f6be2 commit c21282d9869efe5b1461c7961f0df9dbc1933ed0 @iros iros committed Oct 27, 2012
Showing with 111 additions and 85 deletions.
  1. +23 −85 src/view.js
  2. +66 −0 test/unit/bugs.js
  3. +22 −0 test/unit/speed.js
View
108 src/view.js
@@ -638,114 +638,52 @@
* Parameters:
* options - Optional
*/
- sort : function(args) {
- var options = {};
+ sort : function(args) {
+ var options = {}, cachedRows = [];
//If the first param is the comparator, set it as such.
if ( _.isFunction(args) ) {
options.comparator = args;
} else {
- options = args || options;
+ options = args || {};
}
if (options.comparator) {
this.comparator = options.comparator;
- }
-
- if (_.isUndefined(this.comparator)) {
+ } else if (_.isUndefined(this.comparator)) {
throw new Error("Cannot sort without this.comparator.");
- }
-
- var count = this.length, end;
-
- if (count === 1) {
- // we're done. only one item, all sorted.
- return;
}
- var swap = _.bind(function(from, to) {
-
- // move second row over to first
- var row = this.rowByPosition(to);
-
- _.each(row, function(value, column) {
- var colPosition = this._columnPositionByName[column],
- value2 = this._columns[colPosition].data[from];
- this._columns[colPosition].data.splice(from, 1, value);
- this._columns[colPosition].data.splice(to, 1, value2);
- }, this);
- }, this);
-
- var siftDown = _.bind(function(start, end) {
- var root = start, child;
- while (root * 2 <= end) {
- child = root * 2;
- var root_node = this.rowByPosition(root);
-
- if ((child + 1 < end) &&
- this.comparator(
- this.rowByPosition(child),
- this.rowByPosition(child+1)
- ) < 0) {
- child++;
- }
-
- if (this.comparator(
- root_node,
- this.rowByPosition(child)) < 0) {
-
- swap(root, child);
- root = child;
- } else {
- return;
- }
-
- }
-
- }, this);
-
+ // cache rows
+ var i, j, row;
+ for(i = 0; i < this.length; i++) {
+ cachedRows[i] = this._row(i);
+ }
- // puts data in max-heap order
- var heapify = function(count) {
- var start = Math.round((count - 2) / 2);
- while (start >= 0) {
- siftDown(start, count - 1);
- start--;
- }
- };
+ cachedRows.sort( this.comparator );
- if (count > 2) {
- heapify(count);
+ // iterate through cached rows, overwriting data in columns
+ i = cachedRows.length;
+ while ( i-- ) {
+ row = cachedRows[i];
- end = count - 1;
- while (end > 1) {
-
- swap(end, 0);
- end--;
- siftDown(0, end);
+ this._rowIdByPosition[i] = row[ this.idAttribute ];
+ this._rowPositionById[ row[ this.idAttribute ] ] = i;
+ j = this._columns.length;
+ while ( j-- ) {
+ var col = this._columns[j];
+ col.data[i] = row[ col.name ];
}
- } else {
- if (this.comparator(
- this.rowByPosition(0),
- this.rowByPosition(1)) > 0) {
- swap(0,1);
- }
- }
-
- // check last two rows, they seem to always be off sync.
- if (this.comparator(
- this.rowByPosition(this.length - 2),
- this.rowByPosition(this.length - 1)) > 0) {
- swap(this.length - 1,this.length - 2);
}
- if (this.syncable && options.silent) {
+ if (this.syncable && !options.silent) {
this.trigger("sort");
}
+
return this;
},
-
+
/**
* Exports a version of the dataset in json format.
* Returns:
View
66 test/unit/bugs.js
@@ -373,4 +373,70 @@
equals(ds.length, 3);
});
});
+
+ // test("Not even sure yet", function() {
+ // var url = "http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20xml%20where%20url%3D'http%3A%2F%2Fwww.tfl.gov.uk/tfl/syndication/feeds/cycle-hire/livecyclehireupdates.xml'&format=json&diagnostics=true&callback=";
+ // var ds = new Miso.Dataset({
+ // url: url,
+ // jsonp: true,
+ // interval: 5000,
+ // extract: function ( data ) {
+ // snapshot = data.query.results.stations.station;
+ // return snapshot;
+ // },
+ // resetOnFetch: false,
+ // columns: [ // need to specify these so Dataset doesn't trip over null values etc
+ // { name: 'lat', type: 'number' },
+ // { name: 'long', type: 'number' },
+ // { name: 'installDate', type: 'number' },
+ // { name: 'distance', type: 'number' },
+ // { name: 'nbBikes', type: 'number' },
+ // { name: 'nbEmptyDocks', type: 'number' }
+ // ],
+ // sync: true,
+ // uniqueAgainst: 'id',
+ // idAttribute: 'id'
+ // })
+ // ds.fetch();
+ // ds.sort( function ( stationA, stationB ) {
+ // if (stationA.distance > stationB.distance) {
+ // return 1;
+ // } else {
+ // return -1;
+ // }
+ // });
+
+ // });
+ //
+ test("Non -1/0/1 comparators cause a mess", 1, function() {
+ //we use this to check we've managed to update twice
+ //without an error about updating the ID column
+ var count = 0;
+ var ds = new Dataset({
+ url : "/poller/updated.json",
+ interval : 100,
+ uniqueAgainst : "name",
+ sync: true
+ });
+
+ stop();
+ ds.fetch({
+ success : function() {
+ ds.sort(function(a,b) {
+ return a.one - b.one;
+ });
+ count += 1;
+ if (count === 3) {
+ ok(true);
+ start();
+ }
+ },
+ error : function(r) {
+ start();
+ ok(false);
+ }
+ });
+ });
+
+
}(this));
View
22 test/unit/speed.js
@@ -16,6 +16,28 @@
console.profileEnd(test.name);
};
+ JSLitmus.test('sort speed', function() {
+ var a = [5.062887554522604,8.019437238108367,1.1818094248883426,8.77898363629356,5.07132951868698,1.0698147187940776,8.360243949573487,7.5988714187406,6.321605078410357,4.779169838875532,5.499079562723637,8.87307041324675,9.647749240975827,3.44616407295689,2.798574345652014,9.876476943027228,5.048354635946453,0.35216755932196975,6.903689524624497,7.797725256532431,0.6252054474316537,4.193296942394227,9.166340676601976,3.8548882049508393,9.566893046721816,5.674523992929608,2.4994597816839814,0.8383271424099803,3.0059288255870342,2.5477167032659054,4.495156886987388,4.141059468965977,1.0910837282426655,5.665858790744096,7.480061093810946,8.123711452353746,2.737338407896459,1.7024663160555065,7.746574121993035,9.994933430571109,3.5863076779060066,8.074696974363178,6.626787967979908,6.2682069931179285,2.807240281254053,8.198350914753973,0.4594957223162055,0.7015025801956654,8.357715541496873,0.7931741792708635,3.5031288117170334,7.313134076539427,5.096809011884034,9.326885410118848,3.151010051369667,2.3469139193184674,8.410606866236776,8.770834773313254,7.916368441656232,3.1837599468417466,2.8190566995181143,4.123991911765188,2.5233639287762344,4.96267264476046,9.62931499350816,7.070256718434393,1.6554663167335093,4.60065672872588,0.5652313027530909,0.554080696310848,3.7956858845427632,5.7848602859303355,8.877991090994328,8.012738253455609,8.168936006259173,6.810353605542332,4.96930176159367,3.5070674354210496,0.2746906178072095,4.230796478223056,4.975128078367561,4.317553015425801,7.9141087480820715,2.210017223842442,5.900629675015807,3.3146986295469105,4.565864393953234,0.43006700463593006,1.5589286154136062,8.491549845784903,9.347219651099294,4.933474319986999,9.675627034157515,8.41271401848644,7.758268122561276,7.954494929872453,7.173025915399194,3.24938875855878,8.069124247413129,2.671108574140817,2.9862183844670653,5.70805697934702,6.168178676161915,4.163891964126378,3.5199965815991163,3.565027138683945,6.612978340126574,9.887254943605512,6.167980341706425,0.44917974853888154,6.111644750926644,2.442911008838564,8.61514043295756,7.369975633919239,6.77604355616495,6.69537944952026,8.522498107049614,8.18584015360102,6.446634877938777,3.3899540756829083,2.3489556182175875,6.815910344012082,2.3291692161001265,0.4201568476855755,8.06407523341477,6.8409705720841885,8.164295023307204,1.4422485744580626,0.43341653188690543,7.605777864810079,5.3996929177083075,0.3352905297651887,9.598469054326415,4.888024523388594,2.33549727126956,6.747732115909457,3.6500165541656315,3.3499541436322033,9.41529672825709,4.722144766710699,5.892921455670148,3.906460120342672,1.7758592427708209,8.51785326609388,9.440548673737794,3.434295419137925,1.7725313873961568,9.136530575342476,6.684800134971738,5.397859867662191,8.013732992112637,2.5340762664563954,2.8590159863233566,2.3703804658725858,4.929927384946495,5.691915804054588,8.368739385623485,0.8469361392781138,8.692559143528342,9.623451307415962,4.489365494810045,8.766654597129673,1.5402719657868147,5.530301295220852,1.8908253102563322,8.514229028951377,3.2521627540700138,3.7517160503193736,1.4331787405535579,7.485286765731871,2.440766510553658,4.385868366807699,9.12654890678823,6.875267974101007,0.9347955323755741,2.9078101529739797,2.069691182114184,9.325322129298002,8.607286259066314,3.603091207332909,2.9998355894349515,9.000902753323317,7.586191927548498,7.408951355610043,8.884114110842347,5.116117424331605,1.0827498906292021,8.40250184526667,5.762589781079441,5.412142965942621,4.971675635315478,6.335333094466478,0.8059652335941792,9.483819748274982,1.748976141680032,8.646371124777943,9.46213892661035,0.09632813977077603,0.6226694141514599,6.737609424162656,2.178158415481448,9.104574576485902,9.873775178566575,2.8918036655522883,5.979238781146705,8.05347696878016,3.2144198194146156,8.413800341077149,3.383427334483713,7.882561795413494,4.784351992420852,0.9756136150099337,5.846200643572956,2.690484579652548,0.1986534777097404,9.642592284362763,9.015771939884871,1.9886906095780432,1.868042394053191,6.503209504298866,9.79126142570749,9.546975484117866,3.4644764848053455,2.9355376586318016,3.719820298720151,0.23857706226408482,5.56870553875342,9.043361102230847,9.008926737587899,1.2301202095113695,3.6236518807709217,4.567028074525297,4.913034699857235,9.59825423778966,5.467281022574753,6.777618580963463,4.744575314689428,1.301900721155107,9.180301516316831,5.3841956914402544,4.282612584065646,9.521755306050181,4.201848467346281,2.211847857106477,8.32456768490374,0.5901016527786851,9.560005848761648,1.384591048117727,0.35378456814214587,2.8263744129799306,5.0791958486661315,4.398781738709658,9.891788924578577,2.683478151448071,2.3707385757006705,0.21632213378325105,5.3214948694221675,4.1818753886036575,9.963698890060186,5.185774194542319,4.6702307485975325,6.471327564213425,4.801070934627205,5.653523302171379,3.605758026242256,8.879152038134634,9.014398218132555,3.19606106961146,7.578309935051948,5.6810332695022225,3.9303175872191787,5.744068841449916,9.576585097238421,0.46648814575746655,5.85958119481802,3.4899121266789734,7.784349452704191,1.2789348722435534,9.70052924240008,8.150355678517371,1.994936524424702,3.611795457545668,5.662140829954296,9.17409602785483,9.25258667441085,1.99231983628124,1.6396456095390022,0.8757918863557279,7.279059395659715,7.707151479553431,3.578280413057655,7.569061929825693,7.0992778008803725,6.422606117557734,2.5450858194381,8.745181693229824,2.9775620065629482,7.774798271711916,1.0537283099256456,1.4698008261620998,2.4250371591188014,9.702238361351192,1.928959689103067,1.8578488659113646,8.039060803130269,6.485600101295859,0.864317778032273,8.814921220764518,5.098741687834263,3.9010568312369287,0.9369826945476234,1.8109645089134574,2.7116553601808846,9.42722050473094,0.6324310996569693,9.42179326666519,6.887602177448571,0.3492600889876485,0.7133857952430844,0.2333432505838573,8.53641863912344,2.901915409602225,8.933278664480895,9.580563106574118,8.032166087068617,6.894815182313323,4.735735065769404,8.22281499626115,3.630197779275477,4.320077253505588,7.968537562992424,6.2173400283791125,2.6065646880306304,3.0447934614494443,1.2534128944389522,5.075439135544002,8.43631322029978,7.955749831162393,4.547212410252541,7.832609459292144,9.172137952409685,1.5196583769284189,0.16938343178480864,7.004011331591755,2.4073657649569213,6.415748940780759,5.766215466428548,4.563835652079433,2.5342639232985675,6.079549039714038,8.432426303625107,5.0445439969189465,6.757953565102071,2.6117154373787344,3.8135996111668646,4.217679873108864,6.870580837130547,3.1305975164286792,7.340967871714383,1.0579614038579166,6.631250309292227,1.6858202288858593,5.8521981770172715,2.085083187557757,9.42594459746033,1.6368240164592862,9.972062963061035,4.344241078943014,5.854673695284873,7.438597122672945,2.1080215834081173,1.8307841452769935,5.509200026281178,6.497733874712139,5.30902570579201,3.8127736444585025,0.3319351398386061,8.511494498234242,7.052608246449381,7.907924139872193,0.7460463815368712,2.7505762595683336,9.434104112442583,5.417117739561945,1.7338032275438309,2.4147094297222793,2.2672401717863977,0.6535839708521962,3.3547584200277925,7.803820953704417,1.862695210147649,1.2331226165406406,7.395927284378558,0.8096379321068525,6.000011486466974,8.067780612036586,7.647057943977416,9.655684037134051,6.001659121830016,5.628573398571461];
+ var b = [6.669035661034286,6.534390640445054,0.6273159850388765,1.4826027769595385,3.730181301943958,2.221652753651142,6.398897347971797,9.705158344004303,1.1341933207586408,7.227107968647033,4.657545865047723,2.1318981563672423,6.020553309936076,2.0602576318196952,2.2020660992711782,9.977199209388345,9.999152182135731,8.09655568562448,9.224612601101398,3.079596299212426,5.331481827888638,2.033630101941526,3.370772870257497,0.25635240599513054,6.816125740297139,0.8073484874330461,4.01490047108382,5.58391104452312,2.6464781863614917,5.477794227190316,6.530833456199616,4.074759925715625,8.774970602244139,3.3841792517341673,6.348217437043786,5.969295322429389,7.0846285205334425,0.3968807216733694,8.607322790194303,2.9640442063100636,8.886509444564581,9.882619394920766,8.275499932933599,4.916466313879937,5.699882139451802,4.74755480652675,3.978500843513757,6.808232627809048,5.462253806181252,4.684701017104089,6.551832451950759,2.1159239765256643,5.874749373178929,9.28792109945789,7.943632057867944,3.1197822629474103,2.463674144819379,0.7074650516733527,4.172426366712898,9.291511268820614,5.083768784534186,8.454310779925436,6.273454695474356,0.4491270100697875,2.655717039015144,3.4315197891555727,9.45174623047933,6.951579807791859,0.9621696919202805,6.205657725222409,8.74718673992902,0.245284850243479,4.773750843014568,1.337467955891043,1.1802667379379272,9.03316033538431,3.761786217801273,0.09871786460280418,5.977677055634558,8.695163270458579,9.151150919497013,4.194946098141372,6.637787919025868,8.969112555496395,2.1318356483243406,3.4959207172505558,8.033639925997704,1.6865110723301768,8.790688377339393,6.421432150527835,5.13436897424981,7.7729615406133235,0.5288347299210727,5.746311696711928,1.846080448012799,2.558876038528979,5.381114869378507,3.1866280012764037,9.512067751493305,1.7225957568734884,9.318018653430045,0.2512287674471736,7.159515859093517,6.433566594496369,1.9211431522853673,5.9584048576653,5.097113901283592,2.192723590414971,7.0149566303007305,3.724730715621263,7.57052373373881,9.446132406592369,7.031432448420674,8.271101408172399,6.0504250740632415,3.054839768446982,8.328243154101074,2.6225344510748982,3.6101028975099325,2.3782211635261774,6.401266781613231,0.8756087184883654,0.9386312402784824,0.6994869560003281,5.971037815324962,6.180232809856534,5.901556480675936,3.242708183825016,3.637816715054214,8.616818261798471,9.070301833562553,3.3774393843486905,3.0508725089021027,9.512231524568051,5.866706054657698,7.059159446507692,9.85312467906624,4.515491479542106,0.7400049408897758,0.0338168116286397,0.13350735418498516,9.021360846236348,2.501848046667874,2.489079120568931,8.26252089580521,4.460304179228842,6.530663331504911,5.882193669676781,4.354401691816747,2.223742443602532,7.941096902359277,0.26466128416359425,4.231800232082605,7.519286233000457,1.8013701913878322,6.099451363552362,9.063641468528658,2.0840660971589386,6.621273492928594,5.615798968356103,4.024246274493635,6.309856912121177,2.5733393360860646,8.023136763367802,9.737910060212016,3.3907037298195064,5.813516532070935,0.8625167026184499,0.048253273125737906,6.445016069337726,4.1766085918061435,1.2942062341608107,7.518791297916323,4.9497270584106445,8.901384922210127,2.2892695548944175,8.84837849996984,1.2404811335727572,4.573246946092695,4.384312150068581,3.4739286289550364,2.2758528077974916,6.393445220310241,7.949283518828452,8.266054368577898,0.11245208792388439,7.47798094060272,3.3572918083518744,4.317893832921982,6.5249991696327925,8.495376757346094,1.831863047555089,6.110506602562964,9.128458003979176,3.6034645326435566,3.145101915579289,6.19211497483775,7.01977513032034,7.548806157428771,7.920146672986448,6.0347223887220025,8.101019265595824,8.280903180129826,2.0081407576799393,4.375197363551706,8.94988264190033,6.000703682657331,2.1876064501702785,4.798890955280513,6.120517773088068,0.49454061314463615,8.629038238432258,4.738239210564643,7.500348428729922,6.201097557786852,7.16401407495141,8.254410971421748,9.381308767478913,2.2206693794578314,8.457337263971567,3.5720671783201396,4.85424910672009,7.940175887197256,7.754351361654699,0.44884526170790195,7.492464988026768,7.63714925153181,7.5630228547379375,1.1249690619297326,2.1241701068356633,4.229643123690039,6.911654379218817,1.078967924695462,7.105983537621796,7.2953912150114775,1.968571376055479,2.6437453809194267,0.7960402523167431,3.4925946523435414,9.3490996863693,3.2720653573051095,0.6379197165369987,2.9615591769106686,4.14361466653645,0.851764737162739,0.9206054778769612,8.195761570241302,2.77481144759804,2.0525950589217246,6.764065504539758,4.701348461676389,5.953400619328022,7.346107105258852,1.068489234894514,2.5065784715116024,0.4336726269684732,7.902230920735747,6.432476579211652,1.913191785570234,6.545942388474941,5.390000848565251,0.19826381234452128,9.242446776479483,6.162850672844797,6.166738751344383,1.5284789283759892,6.625596736557782,7.257754430174828,3.1391860474832356,9.863811426330358,9.992983336560428,4.203419513069093,8.83139610523358,4.370768521912396,2.7816717932000756,1.3366022147238255,9.471592663321644,4.414557269774377,1.0931559256277978,5.475145892705768,1.7266373476013541,0.4459223197773099,7.956064839381725,4.410713808611035,6.782742072828114,5.765047550667077,9.572135768830776,0.31034125247970223,4.187747368123382,0.337333413772285,5.507318808231503,4.017025667708367,9.655826627276838,3.353781565092504,0.7961616152897477,8.811327882576734,1.8882390577346087,6.452757776714861,1.7692350852303207,3.0604302627034485,4.722903573419899,5.7299144100397825,3.9764321804977953,7.805626813787967,8.980435512494296,1.8169680749997497,2.301386615727097,7.840709730517119,1.8988661374896765,6.935281399637461,0.970542870927602,2.342997915111482,3.9146228623576462,3.442380630876869,1.4939722185954452,4.329623838420957,1.3964211731217802,6.378295568283647,8.88044734718278,2.0934057096019387,2.470519042108208,0.7714638998731971,1.0527726914733648,6.514026334043592,1.0138530284166336,2.6910585002042353,2.7926993649452925,5.803786749020219,1.551738497801125,1.033621986862272,2.384175891056657,0.9390214015729725,1.1199583462439477,3.1443301285617054,2.255701960530132,1.0423280135728419,2.207269142381847,4.493408047128469,1.284123151563108,2.1893148100934923,6.2456256384029984,9.607425886206329,5.921608682256192,5.2748953946866095,9.783834791742265,2.580866136122495,7.009147286880761,9.274075110442936,4.530312640126795,5.220466507598758,9.114823963027447,7.293069397564977,2.340284171514213,8.277304721996188,8.363007395528257,9.797173985280097,7.413199816364795,8.964969187509269,9.8538605007343,0.3822779539041221,7.526516751386225,7.592364577576518,6.891700914129615,5.1221919897943735,3.450908667873591,0.06334321806207299,9.01968002319336,2.5090326135978103,5.8681382541544735,9.503220324404538,2.8434926504269242,2.0041258982382715,9.426738077308983,0.6761969462968409,3.131017559207976,7.463818469550461,7.681429842486978,7.537867648061365,0.8367899968288839,6.5284425392746925,5.836316274944693,9.973736258689314,3.397368537262082,6.229420471936464,0.9060776443220675,8.538484973832965,4.2160229198634624,0.5469710705801845,5.160552517045289,3.379646318498999,7.269773173611611,6.231896881945431,2.414796177763492,3.5215360135771334,6.080372706055641,8.225367285776883,1.4048444526270032,9.423687611706555,1.2589245126582682,3.5042934049852192];
+ var c = [6.961097684688866,4.265788032207638,2.557993088848889,1.6582238324917853,0.5012279865331948,7.734965935815126,9.148107781074941,7.465604778844863,3.7558013666421175,5.79926379956305,3.749844990670681,0.3202662570402026,5.193574381992221,3.484888805542141,9.07212509540841,1.919814480934292,5.782349579967558,6.772660904098302,6.305644602980465,5.966351467650384,0.6110703409649432,3.6793736019171774,9.769340867642313,8.647541301324964,7.489395039156079,6.249178713187575,5.2147923689335585,2.0058046956546605,1.45550204673782,1.9903428992256522,4.613112264778465,3.7174099823459983,3.0650023161433637,1.0043634194880724,1.6464248485863209,4.676634194329381,3.9847689028829336,7.379620068240911,0.9027616609819233,2.397362650372088,5.5704228254035115,6.830579340457916,8.565784245729446,7.295088120736182,1.2223926652222872,1.6426395392045379,7.36399486893788,3.0614071479067206,8.830258885864168,8.95845266059041,3.384169735945761,3.369624966289848,6.236055660992861,5.913221768569201,7.496665078215301,2.351971904281527,8.148728553205729,4.154951320961118,5.839536713901907,9.258618748281151,3.9865159173496068,3.7512342538684607,3.2734106481075287,8.353723690379411,5.530790728516877,7.731626885943115,1.3001867150887847,3.7657982273958623,6.710168281570077,3.9598984038457274,2.7668365254066885,9.368775172624737,3.4494950575754046,4.06214258633554,6.491891050245613,0.34676071954891086,0.4148458898998797,3.6497945501469076,4.613843497354537,8.818662294652313,7.4848293559625745,5.438295402564108,0.14961358392611146,5.625319154933095,4.849452776834369,2.3182028415612876,0.27216846821829677,4.408281561918557,4.907774969469756,9.177215439267457,5.5042776255868375,5.837405263446271,6.417552558705211,3.210886826273054,2.4339508661068976,0.5115957139059901,4.763444929849356,0.4171870229765773,9.493134727235883,3.1174204242415726,9.677542638964951,9.730526614002883,8.622372460085899,2.5396560761146247,4.558139208238572,2.1961568598635495,4.023508436512202,3.506320754531771,7.463748457375914,8.483223936054856,7.640092801302671,9.877511356025934,4.522315624635667,3.429524297825992,7.451378721743822,7.734815995208919,4.81220806017518,5.364696974866092,7.564635565504432,1.1618604301474988,8.969263851176947,1.9997225631959736,0.517047606408596,0.1392261846922338,8.835508208721876,8.52010632166639,7.655645073391497,4.288051617331803,6.349300900474191,8.527026339434087,6.61592788528651,0.06511273793876171,1.9667286658659577,4.139440485741943,1.1098201596178114,3.739649064373225,6.3831097283400595,5.272474093362689,8.329980184789747,7.637835727073252,2.4345488287508488,0.11091568972915411,8.666494928766042,2.6293896161951125,7.7812178689055145,2.4865861632861197,7.45502638630569,0.9043854638002813,8.209888788405806,2.773470738902688,7.65999712748453,3.7857368076220155,7.469282113015652,1.269976559560746,7.4392708064988256,3.3766788546927273,0.7458670623600483,4.2753199697472155,0.9076202753931284,7.967597893439233,3.6570300185121596,1.2519990117289126,3.637374727986753,2.485406599007547,6.084514197427779,6.007117100525647,0.5855859466828406,8.055451775435358,0.2897286228835583,3.62611947581172,7.522619997616857,6.69967656256631,6.801090075168759,0.05346007877960801,2.2034136252477765,0.7854032842442393,4.7079944889992476,6.27155110007152,4.31050282670185,5.137466662563384,2.9493437451310456,0.2476961724460125,6.133519569411874,9.014027921948582,8.94562300061807,6.435421868227422,1.695275278761983,4.2448672582395375,3.283356970641762,9.72662512678653,6.8924600491300225,1.9908087444491684,8.916823212057352,7.955815903842449,3.9845097926445305,8.535213132854551,0.9451032266952097,9.485187521204352,2.458814384881407,1.1678555328398943,0.013203674461692572,9.417460297700018,7.9476544400677085,1.4677385916002095,5.3119619796052575,4.689682796597481,5.03622739110142,1.4231140678748488,1.7285536392591894,4.16902277385816,1.2644063425250351,3.1128788669593632,4.433448133058846,4.364872816950083,3.511196526233107,1.2064621481113136,7.822088918182999,5.611226616892964,0.014917571097612381,5.053074765019119,7.523046531714499,6.8565074796788394,2.4138290132395923,8.60127764288336,9.905494700651616,7.128528417088091,4.507326087914407,0.8096413710154593,2.165026948787272,9.753925516270101,5.675169243477285,2.3109314311295748,7.604964587371796,4.073392814025283,1.1920188437215984,0.06705456180498004,9.489782771561295,6.557947334367782,5.682228771038353,9.678564006462693,2.2954109823331237,7.805967712774873,0.36151232197880745,8.452224624343216,1.7389984428882599,7.364514803048223,6.573033728636801,3.9132918091490865,0.2247926569543779,0.49897250020876527,3.4207010874524713,4.611723676789552,3.2043429790064692,8.309724847786129,2.4993162672035396,0.42013495694845915,1.1410210374742746,7.777099320665002,2.6068496773950756,2.7827080292627215,8.2709835562855,6.957366745918989,6.586323247756809,7.314808941446245,2.4443170987069607,1.2562139448709786,9.279041623231024,1.4528912049718201,2.4358040443621576,4.1771909524686635,6.906225311104208,4.172865692526102,5.202263065148145,2.7912683179602027,2.106732181273401,4.502843818627298,7.853381319437176,6.027964076492935,6.096771906595677,0.7509817811660469,1.2278671725653112,1.588299097493291,3.1173503771424294,6.0794637654908,4.868857397232205,8.642804769333452,3.414397523738444,1.1704540997743607,3.2564873923547566,6.048447710927576,3.318873243406415,2.918638705741614,5.578676462173462,5.44972377596423,3.6150058824568987,1.6935094655491412,7.211971078068018,9.019207942765206,4.743340082932264,4.044776260852814,3.175836738664657,7.448077828157693,0.5054058274254203,6.96432524593547,4.77106380276382,0.9312163083814085,0.9796195128001273,4.477877446915954,2.3590392665937543,6.718957708217204,0.16512565780431032,0.38298300467431545,4.342873471323401,3.9050116017460823,5.552766805049032,1.0269667254760861,3.6051985761150718,4.104336318559945,6.78640988888219,9.567599217407405,6.947749915998429,0.35039472160860896,6.065353697631508,4.0941785322502255,1.3576272246427834,0.4324831417761743,2.488048397935927,5.379006408620626,5.28455087216571,9.017629409208894,0.5057922005653381,5.766452238894999,0.5839017941616476,4.529197150841355,4.673368784133345,3.4472925518639386,5.11174185667187,4.284415887668729,0.11588953901082277,7.467675474472344,9.335075584240258,2.98328839475289,1.104191318154335,5.131744798272848,3.072764149401337,9.416615187656134,9.04148081317544,5.229261526837945,9.999632153194398,0.016797988209873438,5.312237378675491,9.861307942774147,7.381411108653992,9.726490799803287,3.8524477765895426,9.293944570235908,3.333203410729766,5.220801567193121,2.0253129862248898,4.169631965924054,9.712280491366982,5.286176826339215,1.5936801326461136,4.866377625148743,0.44759108452126384,3.684281960595399,4.765043070074171,9.184307740069926,0.9347654227167368,9.824800007045269,7.680977734271437,7.043355302885175,4.564545035827905,8.466491231229156,7.793237557634711,5.0817281124182045,9.698312780819833,6.689896730240434,8.96076327888295,6.702465938869864,2.511244162451476,9.136758411768824,5.255409688688815,5.876735453493893,5.0168120209127665,6.494992913212627,2.892371378839016,4.099190295673907,1.0906379413791,1.7132348171435297,0.37258422235026956,8.659020673949271,8.867210533935577,3.1816737726330757,3.3518107631243765,7.16731928056106,5.315939683932811,7.378969702403992,2.453386806882918,5.08298016153276];
+ var ds = new Miso.Dataset({
+ data: { columns : [
+ { name : "one", data : a },
+ { name : "two", data : b },
+ { name : "three", data : c }
+ ] },
+ strict: true
+ });
+ ds.fetch({
+ success : function() {
+ ds.sort(function(a,b) {
+ return a.one - b.one;
+ });
+ }
+ });
+
+ });
+
JSLitmus.test('add', function() {
var ds = Util.baseSample();

0 comments on commit c21282d

Please sign in to comment.