@@ -212,6 +212,18 @@ const getYMinMaxValues = (series: Data, layout: Partial<Layout> | undefined) =>
212212 return { } ;
213213} ;
214214
215+ const getXMinMaxValues = ( series : Data , layout : Partial < Layout > | undefined ) => {
216+ const range = getXAxisProperties ( series , layout ) ?. range ;
217+ if ( range && range . length === 2 ) {
218+ return {
219+ xMinValue : range [ 0 ] ,
220+ xMaxValue : range [ 1 ] ,
221+ showRoundOffXTickValues : false ,
222+ } ;
223+ }
224+ return { } ;
225+ } ;
226+
215227const getYAxisProperties = ( series : Data , layout : Partial < Layout > | undefined ) : Partial < LayoutAxis > | undefined => {
216228 return layout ?. yaxis ;
217229} ;
@@ -1491,6 +1503,14 @@ export const transformPlotlyJsonToVSBCProps = (
14911503 . forEach ( ( shape , shapeIdx ) => {
14921504 const lineColor = shape . line ?. color ;
14931505 const resolveX = ( val : Datum ) => {
1506+ if ( shape . xref === 'x domain' ) {
1507+ if ( val === 0 ) {
1508+ return xCategories [ 0 ] ;
1509+ }
1510+ if ( val === 1 ) {
1511+ return xCategories [ xCategories . length - 1 ] ;
1512+ }
1513+ }
14941514 if ( typeof val === 'number' && Array . isArray ( xCategories ) ) {
14951515 if ( xCategories [ val ] !== undefined ) {
14961516 return xCategories [ val ] ;
@@ -1563,7 +1583,9 @@ export const transformPlotlyJsonToVSBCProps = (
15631583 showYAxisLables : true ,
15641584 noOfCharsToTruncate : 20 ,
15651585 showYAxisLablesTooltip : true ,
1586+ roundedTicks : true ,
15661587 wrapXAxisLables : typeof vsbcData [ 0 ] ?. xAxisPoint === 'string' ,
1588+ ...getXMinMaxValues ( input . data [ 0 ] , input . layout ) ,
15671589 ...getTitles ( input . layout ) ,
15681590 ...getAxisCategoryOrderProps ( input . data , input . layout ) ,
15691591 ...getYMinMaxValues ( input . data [ 0 ] , input . layout ) ,
@@ -1745,8 +1767,10 @@ export const transformPlotlyJsonToGVBCProps = (
17451767 hideTickOverlap : true ,
17461768 hideLegend,
17471769 roundCorners : true ,
1770+ roundedTicks : true ,
17481771 wrapXAxisLables : true ,
17491772 showYAxisLables : true ,
1773+ ...getXMinMaxValues ( processedInput . data [ 0 ] , processedInput . layout ) ,
17501774 ...getTitles ( processedInput . layout ) ,
17511775 ...getAxisCategoryOrderProps ( processedInput . data , processedInput . layout ) ,
17521776 ...getYMinMaxValues ( processedInput . data [ 0 ] , processedInput . layout ) ,
@@ -1867,8 +1891,10 @@ export const transformPlotlyJsonToVBCProps = (
18671891 maxBarWidth : 50 ,
18681892 hideLegend,
18691893 roundCorners : true ,
1894+ roundedTicks : true ,
18701895 wrapXAxisLables : typeof vbcData [ 0 ] ?. x === 'string' ,
18711896 showYAxisLables : true ,
1897+ ...getXMinMaxValues ( input . data [ 0 ] , input . layout ) ,
18721898 ...getTitles ( input . layout ) ,
18731899 ...getAxisCategoryOrderProps ( input . data , input . layout ) ,
18741900 ...getYMinMaxValues ( input . data [ 0 ] , input . layout ) ,
@@ -2155,6 +2181,8 @@ const transformPlotlyJsonToScatterTraceProps = (
21552181 optimizeLargeData : numDataPoints > 1000 ,
21562182 wrapXAxisLables : shouldWrapLabels ,
21572183 showYAxisLables : true ,
2184+ roundedTicks : true ,
2185+ ...getXMinMaxValues ( input . data [ 0 ] , input . layout ) ,
21582186 ...getTitles ( input . layout ) ,
21592187 ...getXAxisTickFormat ( input . data [ 0 ] , input . layout ) ,
21602188 ...yAxisTickFormat ,
@@ -2172,7 +2200,6 @@ const transformPlotlyJsonToScatterTraceProps = (
21722200 } else {
21732201 return {
21742202 data : isScatterChart ? scatterChartProps : chartProps ,
2175- roundedTicks : true ,
21762203 enableReflow : false ,
21772204 ...commonProps ,
21782205 ...yMinMax ,
@@ -2265,6 +2292,8 @@ export const transformPlotlyJsonToHorizontalBarWithAxisProps = (
22652292 noOfCharsToTruncate : 20 ,
22662293 showYAxisLablesTooltip : true ,
22672294 roundCorners : true ,
2295+ roundedTicks : true ,
2296+ ...getXMinMaxValues ( input . data [ 0 ] , input . layout ) ,
22682297 ...getTitles ( input . layout ) ,
22692298 ...getAxisCategoryOrderProps ( input . data , input . layout ) ,
22702299 ...getBarProps ( input . data , input . layout , true ) ,
@@ -2631,6 +2660,14 @@ export const transformPlotlyJsonToSankeyProps = (
26312660 colorMap ,
26322661 isDarkTheme ,
26332662 ) ;
2663+ const extractedLinkColors = extractColor (
2664+ input . layout ?. template ?. layout ?. colorway ,
2665+ colorwayType ,
2666+ link ?. color ,
2667+ colorMap ,
2668+ isDarkTheme ,
2669+ ) ;
2670+
26342671 const sankeyChartData = {
26352672 nodes : node . label ?. map ( ( label : string , index : number ) => {
26362673 const color = resolveColor (
@@ -2650,8 +2687,17 @@ export const transformPlotlyJsonToSankeyProps = (
26502687 } ) ,
26512688 // eslint-disable-next-line @typescript-eslint/no-explicit-any
26522689 links : validLinks . map ( ( validLink : any , index : number ) => {
2690+ const color = resolveColor (
2691+ extractedLinkColors ,
2692+ index ,
2693+ validLink . target ,
2694+ colorMap ,
2695+ input . layout ?. template ?. layout ?. colorway ,
2696+ isDarkTheme ,
2697+ ) ;
26532698 return {
26542699 ...validLink ,
2700+ color,
26552701 } ;
26562702 } ) ,
26572703 } as ISankeyChartData ;
0 commit comments