@@ -574,104 +574,6 @@ describe('@noCIdep Plotly.react', function() {
574
574
. then ( done , done . fail ) ;
575
575
} ) ;
576
576
577
- function aggregatedPie ( i ) {
578
- var labels = i <= 1 ?
579
- [ 'A' , 'B' , 'A' , 'C' , 'A' , 'B' , 'C' , 'A' , 'B' , 'C' , 'A' ] :
580
- [ 'X' , 'Y' , 'Z' , 'Z' , 'Y' , 'Z' , 'X' , 'Z' , 'Y' , 'Z' , 'X' ] ;
581
- var trace = {
582
- type : 'pie' ,
583
- values : [ 4 , 1 , 4 , 4 , 1 , 4 , 4 , 2 , 1 , 1 , 15 ] ,
584
- labels : labels ,
585
- transforms : [ {
586
- type : 'aggregate' ,
587
- groups : labels ,
588
- aggregations : [ { target : 'values' , func : 'sum' } ]
589
- } ]
590
- } ;
591
- return {
592
- data : [ trace ] ,
593
- layout : {
594
- datarevision : i ,
595
- colorway : [ 'red' , 'orange' , 'yellow' , 'green' , 'blue' , 'violet' ]
596
- }
597
- } ;
598
- }
599
-
600
- var aggPie1CD = [ [
601
- { v : 26 , label : 'A' , color : 'red' , i : 0 } ,
602
- { v : 9 , label : 'C' , color : 'orange' , i : 2 } ,
603
- { v : 6 , label : 'B' , color : 'yellow' , i : 1 }
604
- ] ] ;
605
-
606
- var aggPie2CD = [ [
607
- { v : 23 , label : 'X' , color : 'red' , i : 0 } ,
608
- { v : 15 , label : 'Z' , color : 'orange' , i : 2 } ,
609
- { v : 3 , label : 'Y' , color : 'yellow' , i : 1 }
610
- ] ] ;
611
-
612
- function aggregatedScatter ( i ) {
613
- return {
614
- data : [ {
615
- x : [ 1 , 2 , 3 , 4 , 6 , 5 ] ,
616
- y : [ 2 , 1 , 3 , 5 , 6 , 4 ] ,
617
- transforms : [ {
618
- type : 'aggregate' ,
619
- groups : [ 1 , - 1 , 1 , - 1 , 1 , - 1 ] ,
620
- aggregations : i > 1 ? [ { func : 'last' , target : 'x' } ] : [ ]
621
- } ]
622
- } ] ,
623
- layout : { daterevision : i + 10 }
624
- } ;
625
- }
626
-
627
- var aggScatter1CD = [ [
628
- { x : 1 , y : 2 , i : 0 } ,
629
- { x : 2 , y : 1 , i : 1 }
630
- ] ] ;
631
-
632
- var aggScatter2CD = [ [
633
- { x : 6 , y : 2 , i : 0 } ,
634
- { x : 5 , y : 1 , i : 1 }
635
- ] ] ;
636
-
637
- function aggregatedParcoords ( i ) {
638
- return {
639
- data : [ {
640
- type : 'parcoords' ,
641
- dimensions : [
642
- { label : 'A' , values : [ 1 , 2 , 3 , 4 ] } ,
643
- { label : 'B' , values : [ 4 , 3 , 2 , 1 ] }
644
- ] ,
645
- transforms : i ? [ {
646
- type : 'aggregate' ,
647
- groups : [ 1 , 2 , 1 , 2 ] ,
648
- aggregations : [
649
- { target : 'dimensions[0].values' , func : i > 1 ? 'avg' : 'first' } ,
650
- { target : 'dimensions[1].values' , func : i > 1 ? 'first' : 'avg' }
651
- ]
652
- } ] :
653
- [ ]
654
- } ]
655
- } ;
656
- }
657
-
658
- var aggParcoords0Vals = [ [ 1 , 2 , 3 , 4 ] , [ 4 , 3 , 2 , 1 ] ] ;
659
- var aggParcoords1Vals = [ [ 1 , 2 ] , [ 3 , 2 ] ] ;
660
- var aggParcoords2Vals = [ [ 2 , 3 ] , [ 4 , 3 ] ] ;
661
-
662
- function checkCalcData ( expectedCD ) {
663
- return function ( ) {
664
- expect ( gd . calcdata . length ) . toBe ( expectedCD . length ) ;
665
- expectedCD . forEach ( function ( expectedCDi , i ) {
666
- var cdi = gd . calcdata [ i ] ;
667
- expect ( cdi . length ) . toBe ( expectedCDi . length , i ) ;
668
- expectedCDi . forEach ( function ( expectedij , j ) {
669
- expect ( cdi [ j ] ) . toEqual ( jasmine . objectContaining ( expectedij ) ) ;
670
- } ) ;
671
- } ) ;
672
- } ;
673
- }
674
-
675
577
function checkValues ( expectedVals ) {
676
578
return function ( ) {
677
579
expect ( gd . _fullData . length ) . toBe ( 1 ) ;
@@ -687,73 +589,6 @@ describe('@noCIdep Plotly.react', function() {
687
589
return function ( ) { return Plotly . react ( gd , fig ) ; } ;
688
590
}
689
591
690
- it ( 'can change pie aggregations' , function ( done ) {
691
- Plotly . newPlot ( gd , aggregatedPie ( 1 ) )
692
- . then ( checkCalcData ( aggPie1CD ) )
693
-
694
- . then ( reactTo ( aggregatedPie ( 2 ) ) )
695
- . then ( checkCalcData ( aggPie2CD ) )
696
-
697
- . then ( reactTo ( aggregatedPie ( 1 ) ) )
698
- . then ( checkCalcData ( aggPie1CD ) )
699
- . then ( done , done . fail ) ;
700
- } ) ;
701
-
702
- it ( 'can change scatter aggregations' , function ( done ) {
703
- Plotly . newPlot ( gd , aggregatedScatter ( 1 ) )
704
- . then ( checkCalcData ( aggScatter1CD ) )
705
-
706
- . then ( reactTo ( aggregatedScatter ( 2 ) ) )
707
- . then ( checkCalcData ( aggScatter2CD ) )
708
-
709
- . then ( reactTo ( aggregatedScatter ( 1 ) ) )
710
- . then ( checkCalcData ( aggScatter1CD ) )
711
- . then ( done , done . fail ) ;
712
- } ) ;
713
-
714
- it ( '@gl can change parcoords aggregations' , function ( done ) {
715
- Plotly . newPlot ( gd , aggregatedParcoords ( 0 ) )
716
- . then ( checkValues ( aggParcoords0Vals ) )
717
-
718
- . then ( reactTo ( aggregatedParcoords ( 1 ) ) )
719
- . then ( checkValues ( aggParcoords1Vals ) )
720
-
721
- . then ( reactTo ( aggregatedParcoords ( 2 ) ) )
722
- . then ( checkValues ( aggParcoords2Vals ) )
723
-
724
- . then ( reactTo ( aggregatedParcoords ( 0 ) ) )
725
- . then ( checkValues ( aggParcoords0Vals ) )
726
-
727
- . then ( done , done . fail ) ;
728
- } ) ;
729
-
730
- it ( '@gl can change type with aggregations' , function ( done ) {
731
- Plotly . newPlot ( gd , aggregatedScatter ( 1 ) )
732
- . then ( checkCalcData ( aggScatter1CD ) )
733
-
734
- . then ( reactTo ( aggregatedPie ( 1 ) ) )
735
- . then ( checkCalcData ( aggPie1CD ) )
736
-
737
- . then ( reactTo ( aggregatedParcoords ( 1 ) ) )
738
- . then ( checkValues ( aggParcoords1Vals ) )
739
-
740
- . then ( reactTo ( aggregatedScatter ( 1 ) ) )
741
- . then ( checkCalcData ( aggScatter1CD ) )
742
-
743
- . then ( reactTo ( aggregatedParcoords ( 2 ) ) )
744
- . then ( checkValues ( aggParcoords2Vals ) )
745
-
746
- . then ( reactTo ( aggregatedPie ( 2 ) ) )
747
- . then ( checkCalcData ( aggPie2CD ) )
748
-
749
- . then ( reactTo ( aggregatedScatter ( 2 ) ) )
750
- . then ( checkCalcData ( aggScatter2CD ) )
751
-
752
- . then ( reactTo ( aggregatedParcoords ( 0 ) ) )
753
- . then ( checkValues ( aggParcoords0Vals ) )
754
- . then ( done , done . fail ) ;
755
- } ) ;
756
-
757
592
it ( 'can change frames without redrawing' , function ( done ) {
758
593
var data = [ { y : [ 1 , 2 , 3 ] } ] ;
759
594
var layout = { } ;
0 commit comments