JSPM

@datarailsshared/dr_renderer

1.5.157
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 96
  • Score
    100M100P100Q102833F

DataRails charts and tables renderer

Package Exports

  • @datarailsshared/dr_renderer
  • @datarailsshared/dr_renderer/pivot.css
  • @datarailsshared/dr_renderer/src/pivot.css

Readme

Datarails renderer

This project was generated by amazing Datarails R&D team

Install

npm i @datarailsshared/dr_renderer

Usage

const dr_renderer = require( "@datarailsshared/dr_renderer");
dr_renderer.init($, window, window.document);
let default_colors = ["#106bd0", "#00cee8", "#95c8d8", "#89cff0", "#FE746D", "#6ADC4C", "#9B9AD9", "#ff8000", "#C11B12", "#5a41f9"];
let hr = dr_renderer.getInitHighchartsRenderer($, document, default_colors, Highcharts);

Development

Types

To compile types for the project use: npm run build:types

Publish to npm

Just merge to master branch

Error Handling

The renderer includes a comprehensive error handling system with specific error types for different scenarios:

Error Codes

The following error codes are available via RendererErrorCodes:

  • NoDataError (1) - No data is available for rendering
  • TooMuchDataError (3) - Dataset exceeds capacity
  • DataConflictError (5) - Conflicts detected in data being processed
  • GaugeConfigurationError (6) - Gauge chart missing required data
  • GenericRenderingError (7) - Generic rendering failure in PivotTable components
  • GenericComputationalError (8) - Generic computational failure in PivotTable components

Error Classes

All errors extend the BaseRendererError class which includes:

  • code - Unique error code for identification
  • title - Human-readable error message
  • options - Additional context or configuration

Usage Example

const { RendererErrorCodes, NoDataError, TooMuchDataError } = require('@datarailsshared/dr_renderer');

try {
    // Your rendering code here
} catch (error) {
    if (error instanceof NoDataError) {
        console.log('No data available:', error.title);
    } else if (error.code === RendererErrorCodes.TooMuchDataError) {
        console.log('Too much data:', error.title);
    }
}