Forum Discussion

HamzaJ's avatar
HamzaJ
Data Integration
05-10-2023

Changing fontsize in pivot2 breaks PDF-export

Hey,

So I used the following widgetscript to alter the font in a pivot-table. In the dashboard these alterations are visible, however when exporting it to PDF the pages are all blank.

 

widget.transformPivot(
  {},
  function (metadata, cell) {
    cell.style = {
      backgroundColor : 'lightgray',
      fontSize : 14,
      fontWeight : 'bold',
      fontStyle : 'italic',
      textAlign : 'center',
      color : 'black',
      borderColor : 'black',
      borderWidth : '3px',
      minWidth : '150px',
      maxWidth : '200px'
    };
  }
);

 

 (https://community.sisense.com/t5/build-analytics/pivot-2-0-manipulating-a-pivot-chart/m-p/3589)

Did anyone experience this aswell? Or perhaps uses a different type of script to alter fontsize and color in  

1 Reply

Replies have been turned off for this discussion
  • Hi HamzaJ ,

     

    Please try this script

    widget.transformPivot({
    	type: ['member','value']
    }, (metadata, cell) => {
    	const { columns, rows } = metadata;
    	const isRowHeader = rows && rows.some(row => row.title === cell.content);
    
    	// is header
    	if (isRowHeader || columns && !rows) {
    		cell.style = {
    			fontWeight: 'bold',
    			color: '#132f57',
    			backgroundColor: '#e2e9ec',
    			textAlign: 'center',
    			whiteSpace: 'normal'
    		}
    		
    		// is row
    	} else {
    		cell.style = {
    			fontWeight: 'bold',
    			color: '#132f57'
    		}
    	}
    	//cell.style.whiteSpace= 'normal'
    });

     

    Thanks

    Sijo