apitorenderer

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 21, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrLabelMaxLen contains error message about max label len.
	ErrLabelMaxLen = fmt.Errorf("label max len is %d", labelMaxLen)

	// ErrChartAxesAreNotSpecified contains error message about not specified chart axes.
	ErrChartAxesAreNotSpecified = errors.New("chart axes are not specified")

	// ErrChartTopOrBottomAxisShouldBeSpecified contains error message about not specified top and bottom chart axes.
	ErrChartTopOrBottomAxisShouldBeSpecified = errors.New("chart top or bottom axis is not specified")

	// ErrChartLeftOrRightAxisShouldBeSpecified contains error message about not specified top and bottom chart axes.
	ErrChartLeftOrRightAxisShouldBeSpecified = errors.New("chart left or right axis is not specified")

	// ErrChartAxisKindShouldBeSpecified contains error message about not specified chart axis kind.
	ErrChartAxisKindShouldBeSpecified = errors.New("chart axis kind is not specified")

	// ErrChartTopAndBottomAxesKindsShouldBeEqual contains error message about different kinds of top and bottom axes.
	ErrChartTopAndBottomAxesKindsShouldBeEqual = errors.New("chart top and bottom axes kind should be equal when both axes are provided")

	// ErrChartLeftAndRightAxesKindsShouldBeEqual contains error message about different kinds of left and right axes.
	ErrChartLeftAndRightAxesKindsShouldBeEqual = errors.New("chart left and right axes kind should be equal when both axes are provided")

	// ErrChartScaleDomainShouldBeSpecified contains error message about not specified domain for scale.
	ErrChartScaleDomainShouldBeSpecified = errors.New("chart scale domain should be specified")

	// ErrChartLinearScaleDomainShouldBeSpecified contains error message about not specified numeric domain for linear scale.
	ErrChartLinearScaleDomainShouldBeSpecified = errors.New("chart linear scale numeric domain should be specified")

	// ErrChartBandScaleDomainShouldBeSpecified contains error message about not specified categories domain for band scale.
	ErrChartBandScaleDomainShouldBeSpecified = errors.New("chart band scale categories domain should be specified")

	// ErrChartSizesAreEmpty contains error message about not specified chart sizes.
	ErrChartSizesAreEmpty = errors.New("chart sizes should be specified to set default ranges")

	// ErrChartMarginsAreEmpty contains error message about not specified chart margins.
	ErrChartMarginsAreEmpty = errors.New("chart margins should be specified to set default ranges")

	// ErrChartWidthIsNotSpecified contains error message about not specified chart width.
	ErrChartWidthIsNotSpecified = errors.New("chart width should be specified to set default ranges for horizontal scale")

	// ErrChartHeightIsNotSpecified contains error message about not specified chart height.
	ErrChartHeightIsNotSpecified = errors.New("chart height should be specified to set default ranges for vertical scale")

	// ErrChartLeftAndRightMarginsAreNotSpecified contains error message about not specified chart left and right margins.
	ErrChartLeftAndRightMarginsAreNotSpecified = errors.New("chart left and right margins should be specified to set default ranges for horizontal scale")

	// ErrChartTopAndBottomMarginsAreNotSpecified contains error message about not specified chart top and bottom margins.
	ErrChartTopAndBottomMarginsAreNotSpecified = errors.New("chart top and bottom margins should be specified to set default ranges for vertical scale")
)
View Source
var (
	// ErrChartTopMarginIsTooBig contains error message about too big chart top margin.
	ErrChartTopMarginIsTooBig = fmt.Errorf("chart max top margin is %d", chartMarginMax)

	// ErrChartTopMarginIsTooSmall contains error message about too small chart top margin.
	ErrChartTopMarginIsTooSmall = fmt.Errorf("chart min top margin is %d", chartMarginMin)

	// ErrChartBottomMarginIsTooBig contains error message about too big chart bottom margin.
	ErrChartBottomMarginIsTooBig = fmt.Errorf("chart max bottom margin is %d", chartMarginMax)

	// ErrChartBottomMarginIsTooSmall contains error message about too small chart bottom margin.
	ErrChartBottomMarginIsTooSmall = fmt.Errorf("chart min bottom margin is %d", chartMarginMin)

	// ErrChartLeftMarginIsTooBig contains error message about too big chart left margin.
	ErrChartLeftMarginIsTooBig = fmt.Errorf("chart max left margin is %d", chartMarginMax)

	// ErrChartLeftMarginIsTooSmall contains error message about too small chart left margin.
	ErrChartLeftMarginIsTooSmall = fmt.Errorf("chart min left margin is %d", chartMarginMin)

	// ErrChartRightMarginIsTooBig contains error message about too big chart right margin.
	ErrChartRightMarginIsTooBig = fmt.Errorf("chart max right margin is %d", chartMarginMax)

	// ErrChartRightMarginIsTooSmall contains error message about too small chart right margin.
	ErrChartRightMarginIsTooSmall = fmt.Errorf("chart min right margin is %d", chartMarginMin)
)
View Source
var (
	// ErrChartSizeWidthIsTooBig contains error message about too big chart width size.
	ErrChartSizeWidthIsTooBig = fmt.Errorf("chart size max width is %d", chartSizeMaxWidth)

	// ErrChartSizeWidthIsTooSmall contains error message about too small chart width size.
	ErrChartSizeWidthIsTooSmall = fmt.Errorf("chart size min width is %d", chartSizeMinWidth)

	// ErrChartSizeHeightIsTooBig contains error message about too big chart height size.
	ErrChartSizeHeightIsTooBig = fmt.Errorf("chart size max height is %d", chartSizeMaxHeight)

	// ErrChartSizeHeightIsTooSmall contains error message about too small chart height size.
	ErrChartSizeHeightIsTooSmall = fmt.Errorf("chart size min height is %d", chartSizeMinHeight)
)
View Source
var (
	// ErrChartViewsAreNotSpecified contains error message about not specified chart views.
	ErrChartViewsAreNotSpecified = errors.New("chart views are not specified")

	// ErrChartViewKindIsUnknown contains error message about unknown chart view kind.
	ErrChartViewKindIsUnknown = errors.New("chart view kind is unknown")

	// ErrChartScalesForAreaViewAreBad contains error message about bad scales for area view.
	ErrChartScalesForAreaViewAreBad = errors.New("area chart view needs band horizontal scale and linear vertical scale")

	// ErrChartScalesForHorizontalBarViewAreBad contains error message about bad scales for horizontal bar view.
	ErrChartScalesForHorizontalBarViewAreBad = errors.New("horizontal bar chart view needs linear horizontal scale and band vertical scale")

	// ErrChartScalesForLineViewAreBad contains error message about bad scales for line view.
	ErrChartScalesForLineViewAreBad = errors.New("line chart view needs band horizontal scale and linear vertical scale")

	// ErrChartScalesForScatterViewAreBad contains error message about bad scales for scatter view.
	ErrChartScalesForScatterViewAreBad = errors.New("scatter chart view needs linear horizontal scale and linear vertical scale")

	// ErrChartScalesForVerticalBarViewAreBad contains error message about bad scales for vertical bar view.
	ErrChartScalesForVerticalBarViewAreBad = errors.New("vertical bar chart view needs band horizontal scale and linear vertical scale")

	// ErrChartViewValuesShouldBeSpecified contains error message about not specified chart view values.
	ErrChartViewValuesShouldBeSpecified = errors.New("chart view values should be specified")

	// ErrChartViewValuesCountShouldBeEqualOrLessOfCategoriesCount contains error message about bad amount of chart view values.
	ErrChartViewValuesCountShouldBeEqualOrLessOfCategoriesCount = errors.New("chart view values count should be equal or less than scale categories count")
)
View Source
var ErrTitleMaxLen = fmt.Errorf("title max len is %d", titleMaxLen)

ErrTitleMaxLen contains error message about max title len.

Functions

func ValidateChartAxes

func ValidateChartAxes(chartAxes *render.ChartAxes, chartSizes *render.ChartSizes, chartMargins *render.ChartMargins) (*render.ChartAxes, error)

ValidateChartAxes performs the following:

  • check if chart axes kinds are valid
  • checks RangeStart, RangeEnd, InnerPadding, OuterPadding values if they're specified or sets default values
  • check if scale domain is specified

func ValidateChartMargins

func ValidateChartMargins(chartMargins *render.ChartMargins) (*render.ChartMargins, error)

ValidateChartMargins check if every chart margin value is specified and in acceptable range.

func ValidateChartSizes

func ValidateChartSizes(chartSizes *render.ChartSizes) (*render.ChartSizes, error)

ValidateChartSizes check if every chart size value is specified and in acceptable range.

func ValidateChartTitle added in v0.1.0

func ValidateChartTitle(title string) error

ValidateChartTitle validates the provided title.

func ValidateChartViews

func ValidateChartViews(chartViews []*render.ChartView, catCount int, hScaleKind, vScaleKind render.ChartScale_ChartScaleKind) ([]*render.ChartView, error)

ValidateChartViews validates view kind, colors, labels and values and sets defaults if needed.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL