##// END OF EJS Templates
fixes graph y axis problem
marcink -
r1430:9d19456c beta
parent child Browse files
Show More
@@ -452,43 +452,33 b''
452 452 function getDataAccordingToRanges(ranges) {
453 453
454 454 var data = [];
455 var new_dataset = {};
455 456 var keys = [];
457 var max_commits = 0;
456 458 for(var key in dataset){
457 var push = false;
458 459
459 //method1 slow !!
460 //*
461 460 for(var ds in dataset[key].data){
462 461 commit_data = dataset[key].data[ds];
463 462 if (commit_data.time >= ranges.xaxis.from && commit_data.time <= ranges.xaxis.to){
464 push = true;
465 break;
463
464 if(new_dataset[key] === undefined){
465 new_dataset[key] = {data:[],schema:["commits"],label:key};
466 }
467 new_dataset[key].data.push(commit_data);
466 468 }
467 469 }
468 //*/
469
470 /*//method2 sorted commit data !!!
471
472 var first_commit = dataset[key].data[0].time;
473 var last_commit = dataset[key].data[dataset[key].data.length-1].time;
474
475 if (first_commit >= ranges.xaxis.from && last_commit <= ranges.xaxis.to){
476 push = true;
477 }
478 //*/
479
480 if(push){
481 data.push(dataset[key]);
482 }
470 if (new_dataset[key] !== undefined){
471 data.push(new_dataset[key]);
472 }
483 473 }
484 if(data.length >= 1){
485 return data;
486 }
474
475 if (data.length > 0){
476 return data;
477 }
487 478 else{
488 479 //just return dummy data for graph to plot itself
489 480 return [getDummyData('')];
490 481 }
491
492 482 }
493 483
494 484 /**
@@ -537,7 +527,7 b''
537 527 //resubscribe plothover
538 528 plot.subscribe("plothover", plothover);
539 529
540 // don't fire event on the overview to prevent eternal loop
530 // don't fire event on the overview to prevent eternal loop
541 531 overview.setSelection(cur_ranges, true);
542 532
543 533 }
@@ -549,7 +539,7 b''
549 539 */
550 540 function plotselected(ranges,cur_data) {
551 541 //updates the data for new plot
552 data = getDataAccordingToRanges(ranges);
542 var data = getDataAccordingToRanges(ranges);
553 543 generateCheckboxes(data);
554 544
555 545 var new_options = YAHOO.lang.merge(plot_options, {
@@ -559,13 +549,8 b''
559 549 mode:"time",
560 550 timeformat: "%d/%m",
561 551 },
562 yaxis: {
563 min: ranges.yaxis.from,
564 max: ranges.yaxis.to,
565 },
566
567 552 });
568 // do the zooming
553 // do the zooming
569 554 plot = YAHOO.widget.Flot(plotContainer, data, new_options);
570 555
571 556 plot.subscribe("plotselected", plotselected);
@@ -576,7 +561,7 b''
576 561 // don't fire event on the overview to prevent eternal loop
577 562 overview.setSelection(ranges, true);
578 563
579 //resubscribe choiced
564 //resubscribe choiced
580 565 YUE.on(choiceContainer.getElementsByTagName("input"), "click", plotchoiced, [data, ranges]);
581 566 }
582 567
@@ -644,25 +629,25 b''
644 629 * MAIN EXECUTION
645 630 */
646 631
647 var data = getDataAccordingToRanges(initial_ranges);
632 var data = getDataAccordingToRanges(initial_ranges);
648 633 generateCheckboxes(data);
649 634
650 //main plot
635 //main plot
651 636 var plot = YAHOO.widget.Flot(plotContainer,data,plot_options);
652 637
653 //overview
654 var overview = YAHOO.widget.Flot(overviewContainer, overview_dataset, overview_options);
638 //overview
639 var overview = YAHOO.widget.Flot(overviewContainer,
640 overview_dataset, overview_options);
655 641
656 //show initial selection on overview
642 //show initial selection on overview
657 643 overview.setSelection(initial_ranges);
658 644
659 645 plot.subscribe("plotselected", plotselected);
646 plot.subscribe("plothover", plothover)
660 647
661 648 overview.subscribe("plotselected", function (ranges) {
662 649 plot.setSelection(ranges);
663 650 });
664
665 plot.subscribe("plothover", plothover);
666 651
667 652 YUE.on(choiceContainer.getElementsByTagName("input"), "click", plotchoiced, [data, initial_ranges]);
668 653 }
General Comments 0
You need to be logged in to leave comments. Login now