#[derive(Debug)]
pub enum RendererError {
RenderError(lc_render::Error),
ViewColorsAreNotSpecified,
ViewValuesAreNotSpecified,
ExpectedScalarValues,
ExpectedBarsValues,
ExpectedPointsValues,
ColorsForBarsValuesAreNotSpecified,
FillColorForBarsValuesIsNotSpecified,
StrokeColorForBarsValuesIsNotSpecified,
BarLabelPositionIsUnknown,
PointLabelPositionIsUnknown,
PointTypeIsUnknown,
TopOrBottomAxisShouldBeSpecified,
LeftOrRightAxisShouldBeSpecified,
FillColorForAreaViewIsNotSpecified,
StrokeColorForAreaViewIsNotSpecified,
PointFillColorForAreaViewIsNotSpecified,
PointStrokeColorForAreaViewIsNotSpecified,
StrokeColorForLineViewIsNotSpecified,
PointFillColorForLineViewIsNotSpecified,
PointStrokeColorForLineViewIsNotSpecified,
PointFillColorForScatterViewIsNotSpecified,
PointStrokeColorForScatterViewIsNotSpecified,
ViewKindIsUnknown,
ChartAxesAreNotSpecified,
ChartSizesAreNotSpecified,
ChartWidthIsNotSpecified,
ChartHeightIsNotSpecified,
ChartMarginsAreNotSpecified,
ChartTopMarginIsNotSpecified,
ChartBottomMarginIsNotSpecified,
ChartLeftMarginIsNotSpecified,
ChartRightMarginIsNotSpecified,
TopAxisIsSetButItsNotBandOrLinear,
BottomAxisIsSetButItsNotBandOrLinear,
LeftAxisIsSetButItsNotBandOrLinear,
RightAxisIsSetButItsNotBandOrLinear,
PointVisibilityForAreaViewIsNotSpecified,
PointLabelVisibilityForAreaViewIsNotSpecified,
PointVisibilityForLineViewIsNotSpecified,
PointLabelVisibilityForLineViewIsNotSpecified,
PointVisibilityForScatterViewIsNotSpecified,
PointLabelVisibilityForScatterViewIsNotSpecified,
BarLabelVisibilityForHorizontalBarViewIsNotSpecified,
BarLabelVisibilityForVerticalBarViewIsNotSpecified,
ScaleRangeStartIsNotSpecified,
ScaleRangeEndIsNotSpecified,
ScaleDomainIsNotSpecified,
LinearScaleNumericDomainIsNotSpecified,
BandScaleCategoriesDomainIsNotSpecified,
BandScaleInnerPaddingIsNotSpecified,
BandScaleOuterPaddingIsNotSpecified,
}
impl std::fmt::Display for RendererError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match &*self {
RendererError::RenderError(e) => e.fmt(f),
RendererError::ViewColorsAreNotSpecified => {
"view colors are not specified".to_string().fmt(f)
}
RendererError::ViewValuesAreNotSpecified => {
"view values are not specified".to_string().fmt(f)
}
RendererError::ExpectedScalarValues => {
"expected scalar values for view".to_string().fmt(f)
}
RendererError::ExpectedBarsValues => "expected bars values for view".to_string().fmt(f),
RendererError::ExpectedPointsValues => {
"expected points values for view".to_string().fmt(f)
}
RendererError::ColorsForBarsValuesAreNotSpecified => {
"colors for bars values are not specified"
.to_string()
.fmt(f)
}
RendererError::FillColorForBarsValuesIsNotSpecified => {
"fill color for bars values is not specified"
.to_string()
.fmt(f)
}
RendererError::StrokeColorForBarsValuesIsNotSpecified => {
"stroke color for bars values is not specified"
.to_string()
.fmt(f)
}
RendererError::BarLabelPositionIsUnknown => {
"view bar label position is unknown".to_string().fmt(f)
}
RendererError::PointLabelPositionIsUnknown => {
"view point label position is unknown".to_string().fmt(f)
}
RendererError::PointTypeIsUnknown => "view point type is unknown".to_string().fmt(f),
RendererError::TopOrBottomAxisShouldBeSpecified => {
"top or bottom axis should be specified".to_string().fmt(f)
}
RendererError::LeftOrRightAxisShouldBeSpecified => {
"left or right axis should be specified".to_string().fmt(f)
}
RendererError::FillColorForAreaViewIsNotSpecified => {
"fill color for area view is not specified"
.to_string()
.fmt(f)
}
RendererError::StrokeColorForAreaViewIsNotSpecified => {
"stroke color for area view is not specified"
.to_string()
.fmt(f)
}
RendererError::PointFillColorForAreaViewIsNotSpecified => {
"point fill color for area view is not specified"
.to_string()
.fmt(f)
}
RendererError::PointStrokeColorForAreaViewIsNotSpecified => {
"point stroke color for area view is not specified"
.to_string()
.fmt(f)
}
RendererError::StrokeColorForLineViewIsNotSpecified => {
"stroke color for line view is not specified"
.to_string()
.fmt(f)
}
RendererError::PointFillColorForLineViewIsNotSpecified => {
"point fill color for line view is not specified"
.to_string()
.fmt(f)
}
RendererError::PointStrokeColorForLineViewIsNotSpecified => {
"point stroke color for line view is not specified"
.to_string()
.fmt(f)
}
RendererError::PointFillColorForScatterViewIsNotSpecified => {
"point fill color for scatter view is not specified"
.to_string()
.fmt(f)
}
RendererError::PointStrokeColorForScatterViewIsNotSpecified => {
"point stroke color for scatter view is not specified"
.to_string()
.fmt(f)
}
RendererError::ViewKindIsUnknown => "view kind is unknown".to_string().fmt(f),
RendererError::ChartAxesAreNotSpecified => {
"chart axes are not be specified".to_string().fmt(f)
}
RendererError::ChartSizesAreNotSpecified => {
"chart sizes are not specified".to_string().fmt(f)
}
RendererError::ChartWidthIsNotSpecified => {
"chart width is not specified".to_string().fmt(f)
}
RendererError::ChartHeightIsNotSpecified => {
"chart height is not specified".to_string().fmt(f)
}
RendererError::ChartMarginsAreNotSpecified => {
"chart margins are not specified".to_string().fmt(f)
}
RendererError::ChartTopMarginIsNotSpecified => {
"chart top margin is not specified".to_string().fmt(f)
}
RendererError::ChartBottomMarginIsNotSpecified => {
"chart bottom margin is not specified".to_string().fmt(f)
}
RendererError::ChartLeftMarginIsNotSpecified => {
"chart left margin is not specified".to_string().fmt(f)
}
RendererError::ChartRightMarginIsNotSpecified => {
"chart right margin is not specified".to_string().fmt(f)
}
RendererError::TopAxisIsSetButItsNotBandOrLinear => {
"top axis is set but it's not of band or linear kind"
.to_string()
.fmt(f)
}
RendererError::BottomAxisIsSetButItsNotBandOrLinear => {
"bottom axis is set but it's not of band or linear kind"
.to_string()
.fmt(f)
}
RendererError::LeftAxisIsSetButItsNotBandOrLinear => {
"left axis is set but it's not of band or linear kind"
.to_string()
.fmt(f)
}
RendererError::RightAxisIsSetButItsNotBandOrLinear => {
"right axis is set but it's not of band or linear kind"
.to_string()
.fmt(f)
}
RendererError::PointVisibilityForAreaViewIsNotSpecified => {
"point visibility for area view is not specified"
.to_string()
.fmt(f)
}
RendererError::PointLabelVisibilityForAreaViewIsNotSpecified => {
"point label visibility for area view is not specified"
.to_string()
.fmt(f)
}
RendererError::PointVisibilityForLineViewIsNotSpecified => {
"point visibility for line view is not specified"
.to_string()
.fmt(f)
}
RendererError::PointLabelVisibilityForLineViewIsNotSpecified => {
"point label visibility for line view is not specified"
.to_string()
.fmt(f)
}
RendererError::PointVisibilityForScatterViewIsNotSpecified => {
"point visibility for scatter view is not specified"
.to_string()
.fmt(f)
}
RendererError::PointLabelVisibilityForScatterViewIsNotSpecified => {
"point label visibility for scatter view is not specified"
.to_string()
.fmt(f)
}
RendererError::BarLabelVisibilityForHorizontalBarViewIsNotSpecified => {
"bar label visibility for horizontal bar view is not specified"
.to_string()
.fmt(f)
}
RendererError::BarLabelVisibilityForVerticalBarViewIsNotSpecified => {
"bar label visibility for vertical bar is not specified"
.to_string()
.fmt(f)
}
RendererError::ScaleRangeStartIsNotSpecified => {
"range start for scale is not specified".to_string().fmt(f)
}
RendererError::ScaleRangeEndIsNotSpecified => {
"range end for scale is not specified".to_string().fmt(f)
}
RendererError::ScaleDomainIsNotSpecified => {
"domain for scale is not specified".to_string().fmt(f)
}
RendererError::LinearScaleNumericDomainIsNotSpecified => {
"numeric domain for linear scale is not specified"
.to_string()
.fmt(f)
}
RendererError::BandScaleCategoriesDomainIsNotSpecified => {
"categories domain for band scale is not specified"
.to_string()
.fmt(f)
}
RendererError::BandScaleInnerPaddingIsNotSpecified => {
"inner padding for band scale is not specified"
.to_string()
.fmt(f)
}
RendererError::BandScaleOuterPaddingIsNotSpecified => {
"outer padding for band scale is not specified"
.to_string()
.fmt(f)
}
}
}
}
impl std::error::Error for RendererError {}
impl std::convert::From<lc_render::Error> for RendererError {
fn from(e: lc_render::Error) -> Self {
RendererError::RenderError(e)
}
}