Package Exports
- @datarailsshared/dr_renderer
- @datarailsshared/dr_renderer/src/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@datarailsshared/dr_renderer) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
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);
}
}