##// 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 function getDataAccordingToRanges(ranges) {
452 function getDataAccordingToRanges(ranges) {
453
453
454 var data = [];
454 var data = [];
455 var new_dataset = {};
455 var keys = [];
456 var keys = [];
457 var max_commits = 0;
456 for(var key in dataset){
458 for(var key in dataset){
457 var push = false;
458
459
459 //method1 slow !!
460 //*
461 for(var ds in dataset[key].data){
460 for(var ds in dataset[key].data){
462 commit_data = dataset[key].data[ds];
461 commit_data = dataset[key].data[ds];
463 if (commit_data.time >= ranges.xaxis.from && commit_data.time <= ranges.xaxis.to){
462 if (commit_data.time >= ranges.xaxis.from && commit_data.time <= ranges.xaxis.to){
464 push = true;
463
465 break;
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 //*/
470 if (new_dataset[key] !== undefined){
469
471 data.push(new_dataset[key]);
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 }
472 }
483 }
473 }
484 if(data.length >= 1){
474
475 if (data.length > 0){
485 return data;
476 return data;
486 }
477 }
487 else{
478 else{
488 //just return dummy data for graph to plot itself
479 //just return dummy data for graph to plot itself
489 return [getDummyData('')];
480 return [getDummyData('')];
490 }
481 }
491
492 }
482 }
493
483
494 /**
484 /**
@@ -549,7 +539,7 b''
549 */
539 */
550 function plotselected(ranges,cur_data) {
540 function plotselected(ranges,cur_data) {
551 //updates the data for new plot
541 //updates the data for new plot
552 data = getDataAccordingToRanges(ranges);
542 var data = getDataAccordingToRanges(ranges);
553 generateCheckboxes(data);
543 generateCheckboxes(data);
554
544
555 var new_options = YAHOO.lang.merge(plot_options, {
545 var new_options = YAHOO.lang.merge(plot_options, {
@@ -559,11 +549,6 b''
559 mode:"time",
549 mode:"time",
560 timeformat: "%d/%m",
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 plot = YAHOO.widget.Flot(plotContainer, data, new_options);
554 plot = YAHOO.widget.Flot(plotContainer, data, new_options);
@@ -651,19 +636,19 b''
651 var plot = YAHOO.widget.Flot(plotContainer,data,plot_options);
636 var plot = YAHOO.widget.Flot(plotContainer,data,plot_options);
652
637
653 //overview
638 //overview
654 var overview = YAHOO.widget.Flot(overviewContainer, overview_dataset, overview_options);
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 overview.setSelection(initial_ranges);
643 overview.setSelection(initial_ranges);
658
644
659 plot.subscribe("plotselected", plotselected);
645 plot.subscribe("plotselected", plotselected);
646 plot.subscribe("plothover", plothover)
660
647
661 overview.subscribe("plotselected", function (ranges) {
648 overview.subscribe("plotselected", function (ranges) {
662 plot.setSelection(ranges);
649 plot.setSelection(ranges);
663 });
650 });
664
651
665 plot.subscribe("plothover", plothover);
666
667 YUE.on(choiceContainer.getElementsByTagName("input"), "click", plotchoiced, [data, initial_ranges]);
652 YUE.on(choiceContainer.getElementsByTagName("input"), "click", plotchoiced, [data, initial_ranges]);
668 }
653 }
669 SummaryPlot(${c.ts_min},${c.ts_max},${c.commit_data|n},${c.overview_data|n});
654 SummaryPlot(${c.ts_min},${c.ts_max},${c.commit_data|n},${c.overview_data|n});
General Comments 0
You need to be logged in to leave comments. Login now