@@ -19,7 +19,7 @@ import '../../../node_modules/es6-promise/dist/es6-promise';
19
19
import { tooltipData21 , tooltipData22 , datetimeData21 , negativeDataPoint , seriesData1 , rotateData1 , rotateData2 } from '../base/data.spec' ;
20
20
import { EmitType } from '@syncfusion/ej2-base' ;
21
21
import { profile , inMB , getMemoryProfile } from '../../common.spec' ;
22
- import { ILoadedEventArgs , IAnimationCompleteEventArgs , IPointRenderEventArgs } from '../../../src/chart/model/chart-interface' ;
22
+ import { ILoadedEventArgs , IAnimationCompleteEventArgs , IPointRenderEventArgs , IAxisLabelRenderEventArgs , ITooltipRenderEventArgs } from '../../../src/chart/model/chart-interface' ;
23
23
import { Legend } from '../../../src/chart/legend/legend' ;
24
24
25
25
Chart . Inject ( LineSeries , StackingColumnSeries , DateTime , Category , DataLabel , ColumnSeries , Legend ) ;
@@ -1972,6 +1972,163 @@ describe('Chart Control', () => {
1972
1972
chartObj . refresh ( ) ;
1973
1973
} ) ;
1974
1974
} ) ;
1975
+ describe ( 'StackingColumn and StackingColumn100 Series in Cyliderical shape' , ( ) => {
1976
+ let chartObj : Chart ;
1977
+ let loaded : EmitType < ILoadedEventArgs > ;
1978
+ let animate : EmitType < IAnimationCompleteEventArgs > ;
1979
+ let element : HTMLElement = createElement ( 'div' , { id : 'container' } ) ;
1980
+ beforeAll ( ( ) => {
1981
+ document . body . appendChild ( element ) ;
1982
+ chartObj = new Chart (
1983
+ {
1984
+ primaryXAxis : {
1985
+ interval : 1 ,
1986
+ valueType : 'Category' ,
1987
+ } ,
1988
+ //Initializing Primary Y Axis
1989
+ primaryYAxis : {
1990
+ maximum : 60 ,
1991
+ interval : 10 ,
1992
+ } ,
1993
+ stackLabels : {
1994
+ visible : true ,
1995
+ format : '{value}M' ,
1996
+ font : {
1997
+ size : '12px' ,
1998
+ } ,
1999
+ } ,
2000
+ //Initializing Chart Series
2001
+ series : [
2002
+ {
2003
+ type : 'StackingColumn' ,
2004
+ dataSource : [
2005
+ { x : '2018' , y : 24.5 } ,
2006
+ { x : '2019' , y : 25.6 } ,
2007
+ { x : '2020' , y : 29 } ,
2008
+ { x : '2021' , y : 28.5 } ,
2009
+ { x : '2022' , y : 30.6 } ,
2010
+ ] ,
2011
+ xName : 'x' ,
2012
+ stackingGroup : 'Asia' ,
2013
+ yName : 'y' ,
2014
+ name : 'Iran' ,
2015
+ columnWidth : 0.6 ,
2016
+ marker : { dataLabel : { visible : true } } ,
2017
+ } ,
2018
+ {
2019
+ type : 'StackingColumn' ,
2020
+ dataSource : [
2021
+ { x : '2018' , y : 6.2 } ,
2022
+ { x : '2019' , y : 15.6 } ,
2023
+ { x : '2020' , y : 14.3 } ,
2024
+ { x : '2021' , y : 9.3 } ,
2025
+ { x : '2022' , y : 7.8 } ,
2026
+ ] ,
2027
+ xName : 'x' ,
2028
+ stackingGroup : 'Asia' ,
2029
+ yName : 'y' ,
2030
+ name : 'Indonesia' ,
2031
+ columnWidth : 0.6 ,
2032
+ marker : { dataLabel : { visible : true } } ,
2033
+ } ,
2034
+ {
2035
+ type : 'StackingColumn' ,
2036
+ dataSource : [
2037
+ { x : '2018' , y : 24.5 } ,
2038
+ { x : '2019' , y : 23.2 } ,
2039
+ { x : '2020' , y : 20.4 } ,
2040
+ { x : '2021' , y : 23.2 } ,
2041
+ { x : '2022' , y : 24.5 } ,
2042
+ ] ,
2043
+ xName : 'x' ,
2044
+ stackingGroup : 'Europe' ,
2045
+ yName : 'y' ,
2046
+ name : 'Italy' ,
2047
+ columnWidth : 0.6 ,
2048
+ marker : { dataLabel : { visible : true } } ,
2049
+ } ,
2050
+ {
2051
+ type : 'StackingColumn' ,
2052
+ dataSource : [
2053
+ { x : '2018' , y : 15.4 } ,
2054
+ { x : '2019' , y : 21.1 } ,
2055
+ { x : '2020' , y : 13.9 } ,
2056
+ { x : '2021' , y : 11.6 } ,
2057
+ { x : '2022' , y : 14.4 } ,
2058
+ ] ,
2059
+ xName : 'x' ,
2060
+ stackingGroup : 'Europe' ,
2061
+ yName : 'y' ,
2062
+ name : 'France' ,
2063
+ columnWidth : 0.6 ,
2064
+ marker : { dataLabel : { visible : true } } ,
2065
+ } ,
2066
+ ] ,
2067
+
2068
+ //Initializing Chart title
2069
+ title : 'Steel Production by Countries, Grouped by Continent' ,
2070
+ //Initializing User Interaction Tooltip
2071
+ tooltip : {
2072
+ enable : true ,
2073
+ format : '${point.x} : <b>${point.y} Mmt' ,
2074
+ } ,
2075
+
2076
+ legendSettings : {
2077
+ visible : true ,
2078
+ enableHighlight : true ,
2079
+ shapeWidth : 9 ,
2080
+ shapeHeight : 9 ,
2081
+ } ,
2082
+ load : ( args : ILoadedEventArgs ) => {
2083
+
2084
+ } ,
2085
+ axisLabelRender : ( args : IAxisLabelRenderEventArgs ) => {
2086
+ const value : number = parseInt ( args . text . replace ( / , / g, '' ) , 10 ) ;
2087
+ if ( value >= 1000 ) {
2088
+ args . text = value / 1000 + 'K' ;
2089
+ }
2090
+ } ,
2091
+ tooltipRender : ( args : ITooltipRenderEventArgs ) => {
2092
+ if ( args . text ) {
2093
+ let value : string = args . point . y . toLocaleString ( 'en-US' ) ;
2094
+ args . text = `${ args . series . name } : <b>${ value } </b>` ;
2095
+ }
2096
+ } ,
2097
+ } ) ;
2098
+ chartObj . appendTo ( '#container' ) ;
2099
+ } ) ;
2100
+
2101
+ afterAll ( ( ) : void => {
2102
+ chartObj . destroy ( ) ;
2103
+ element . remove ( ) ;
2104
+ } ) ;
2105
+ it ( 'Stacking column grouped - stacking label position' , function ( done ) {
2106
+ loaded = function ( args ) {
2107
+ let stackLabel = document . getElementById ( 'container_StackLabel_0' ) . getAttribute ( 'x' ) ;
2108
+ let stackLabel1 = document . getElementById ( 'container_StackLabel_2' ) . getAttribute ( 'x' ) ;
2109
+ let stackLabel2 = document . getElementById ( 'container_StackLabel_4' ) . getAttribute ( 'x' ) ;
2110
+ let stackContent = document . getElementById ( 'container_StackLabel_2' ) . textContent ;
2111
+ expect ( stackContent ) . toBe ( '43.3M' ) ;
2112
+ stackContent = document . getElementById ( 'container_StackLabel_0' ) . textContent ;
2113
+ expect ( stackContent ) . toBe ( '30.7M' ) ;
2114
+ stackContent = document . getElementById ( 'container_StackLabel_4' ) . textContent ;
2115
+ expect ( stackContent ) . toBe ( '38.4M' ) ;
2116
+ expect ( stackLabel ) . toBe ( '83.355' ) ;
2117
+ expect ( stackLabel1 ) . toBe ( '373.95500000000004' ) ;
2118
+ expect ( stackLabel2 ) . toBe ( '664.5550000000001' ) ;
2119
+ stackLabel = document . getElementById ( 'container_StackLabel_0' ) . getAttribute ( 'y' ) ;
2120
+ stackLabel1 = document . getElementById ( 'container_StackLabel_2' ) . getAttribute ( 'y' ) ;
2121
+ stackLabel2 = document . getElementById ( 'container_StackLabel_4' ) . getAttribute ( 'y' ) ;
2122
+ expect ( stackLabel ) . toBe ( '198.42875' ) ;
2123
+ expect ( stackLabel1 ) . toBe ( '127.39625000000004' ) ;
2124
+ expect ( stackLabel2 ) . toBe ( '155.01999999999998' ) ;
2125
+ done ( ) ;
2126
+ } ;
2127
+ chartObj . loaded = loaded ;
2128
+ chartObj . refresh ( ) ;
2129
+ } ) ;
2130
+ } ) ;
2131
+
1975
2132
it ( 'memory leak' , ( ) => {
1976
2133
profile . sample ( ) ;
1977
2134
let average : any = inMB ( profile . averageChange )
0 commit comments