How to use the @lumino/datagrid.TextRenderer.formatFixed function in @lumino/datagrid

To help you get started, we’ve selected a few @lumino/datagrid examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jupyterlab / lumino / examples / example-datagrid / src / index.ts View on Github external
...DataGrid.defaultStyle,
    rowBackgroundColor: i => i % 2 === 0 ? 'rgba(64, 115, 53, 0.2)' : ''
  };

  let lightSelectionStyle: DataGrid.Style = {
    ...DataGrid.defaultStyle,
    selectionFillColor: 'rgba(255, 255, 255, 0.2)',
    selectionBorderColor: 'white',
    headerSelectionBorderColor: 'white',
    cursorBorderColor: 'white'
  };

  let fgColorFloatRenderer = new TextRenderer({
    font: 'bold 12px sans-serif',
    textColor: redGreenBlack,
    format: TextRenderer.formatFixed({ digits: 2 }),
    horizontalAlignment: 'right'
  });

  let bgColorFloatRenderer = new TextRenderer({
    textColor: heatMapViridisInverse,
    backgroundColor: heatMapViridis,
    format: TextRenderer.formatFixed({ digits: 2 }),
    horizontalAlignment: 'right'
  });

  let grid1 = new DataGrid({ style: blueStripeStyle });
  grid1.dataModel = model1;
  grid1.keyHandler = new BasicKeyHandler();
  grid1.mouseHandler = new BasicMouseHandler();
  grid1.selectionModel = new BasicSelectionModel({ dataModel: model1 });