d3-stencil
Version:
Charts built with D3 and Stencil. Framework-agnostic, simple.
16 lines (15 loc) • 705 B
JavaScript
const THROW_ERROR = () => {
throw new Error(`The data injected isn't valid.`);
};
export const hasDataIsNotEmpty = ({ data, labels, }) => data.length > 0 && labels.length >= 1 ? true : THROW_ERROR();
export const hasDataValidOnAnnotationsChart = ({ data, lineAnnotationsChart, }) => {
if (!(data.length > 0 &&
lineAnnotationsChart.increaseHeight > 0 &&
lineAnnotationsChart.tickSeparation !== '' &&
lineAnnotationsChart.imagePathOneAnnotation !== '' &&
lineAnnotationsChart.imagePathSomeAnnotations !== '')) {
return THROW_ERROR();
}
return true;
};
export const hasDataBCGMatrixIsNotEmpty = ({ data, }) => (data.length > 0 ? true : THROW_ERROR());