@datarailsshared/dr_renderer
v1.5.174
Published
DataRails charts and tables renderer
Readme
Datarails renderer
This project was generated by amazing Datarails R&D team
Install
npm i @datarailsshared/dr_rendererUsage
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 renderingTooMuchDataError(3) - Dataset exceeds capacityDataConflictError(5) - Conflicts detected in data being processedGaugeConfigurationError(6) - Gauge chart missing required dataGenericRenderingError(7) - Generic rendering failure in PivotTable componentsGenericComputationalError(8) - Generic computational failure in PivotTable components
Error Classes
All errors extend the BaseRendererError class which includes:
code- Unique error code for identificationtitle- Human-readable error messageoptions- 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);
}
}