Options
All
  • Public
  • Public/Protected
  • All
Menu

Charts powered by claviz-charts library.

Example of usage

export const component: DraymanComponent = async ({ forceUpdate }) => {

    let selected: { value: number; label: string; };

    return () => {
        const onClick = async (data) => {
            selected = data;
            await forceUpdate();
        }

        return (
            <div style={{ height: '200px' }}>
                <drayman-claviz-charts
                    data={
                        [
                            {
                                color: 'black',
                                label: 'Fruits',
                                data: [
                                    {
                                        value: 10,
                                        label: 'Apples',
                                        color: 'green'
                                    },
                                    {
                                        value: 5,
                                        label: 'Oranges',
                                        color: 'orange'
                                    }
                                ]
                            },
                            {
                                color: 'black',
                                label: 'Vegetables',
                                data: [
                                    {
                                        value: 12,
                                        label: 'Tomatoes',
                                        color: 'red'
                                    },
                                ]
                            }
                        ]}
                    onClick={onClick}
                />
                {selected && `You have selected ${selected.value} ${selected.label}!`}
            </div>
        )
    }
}

Hierarchy

Index

Properties

data

data: ContainerChartLine[]

Array of data to display.

Optional onClick

onClick: (data: any) => ElementEvent<void>

Function that will be executed when user clicks a chart element.

Type declaration

Optional orientation

orientation: "horizontal" | "vertical"

horizontal by default.

Optional padding

padding: number

Padding in px between chart elements. 15 by default.

Optional ref

ref: string

Optional reversed

reversed: boolean

false by default. Determines location of the line base

Optional style

style: CSS

Optional verticalTextTopDown

verticalTextTopDown: boolean

false by default. Change text orientation to top-down when it is positioned vertically.