Single Chart

  • Shows charts with different types.

Example Link

Features/Functionality

  • Shows chart with given variant.
  • Chart with multiple datasets is shown
  • On click of chart callback is called.
  • Component is responsive.
  • It is cross browser compatible. (Edge, Firefox, chrome).

Basic Usage

Dependencies

Definition

<cst-s-single-chart schema.bind="${schema}"></cst-s-single-chart>

Schema Description

AttributeValueDescription
idstring typeIdentifier for component.
variantstring typeChart type to be shown.

data

array of objects typeData to be shown in chart.

dataAPI

object typeData to call API.

options

object typeOptions for the component.
onClickstring typeCallback method to be called on item click.
dataFormatCallbackstring typeCallback method to be called to format data.
elmInstanceobject typeVariable holding instance of component.

sub-theme

object typeSpecifies theme to be used for component.

sub-font

object typeSpecifies fonts to be used for component.

sub-style

object typeSpecifies style to be applied to component.

sub-feature-flag

objectSpecifies what features to enable/disable.

sub-access-ctrl

objectSpecifies what access is given.

sub-raw-attributes

objectSpecifies raw attributes.
otherany typeAny other info.
customParentContextanyParent Context.

Sub element attributes

data

PropertyValueDescription
labelstring typeValue to be shown in x axis.
valuenumber typevalue to be shown.
itemsarray typeArray of Objects with label and value to create datasets.

dataAPI

PropertyValueDescription
methodstring typeAPI Request Method
urlstring typeURL to be called.
bodyobject typeBody to be sent in request.

options

PropertyValueDescription

labels

object typeLabels to be shown.
titlestring typeChart Title.

yAxis

object typeyAxis options.
yAxisTrimLabelLengthnumber typeLength of labels.
outsideSameColorboolean typeTo show the same or different colors of data points.
datasetSameColorboolean typeTo show the same or different colors of dataset.
shadeArrarray typeArray of shades to be shown.

labels

PropertyValueDescription
yAxisstring typeLabel to be shown in yAxis.
xAxisstring typeLabel to be shown in xAxis.
itemsarray typeLabel values to be shown on hover of chart.

yAxis

PropertyValueDescription
startValuenumber typeStart value of yAxis scale.
endValuenumber typeEnd value of yAxis scale.
stepValuenumber typeStep size.

sub-theme

PropertyValueDescription
nameprimary(default)/secondary/custom themeName of the theme.

sub-font

PropertyValueDescription
nameprimary (default roboto)/secondary/ custom fontName of the font

sub-style

PropertyValueDescription
nameprimary (material default)/ secondary skeuomorphic(standard/filled/shaped-filled/outlined/shaped-outlined)/ customName of design to be used.
widthpercentage/pixels/string(small,medium,large)Gives width/any other prop value

sub-feature-flag

PropertyValueDescription
show-chart-types???Specifies which chart type to be shown.

sub-access-ctrl

PropertyValueDescription
can-viewboolean typeSpecifies if user has access to view component.
can-clickboolean typeSpecifies if user has access to click on component.
can-change-typeboolean typeSpecifies if user has access to change default type of chart.

sub-raw-attributes

PropertyValueDescription
classstringSpecifies class name to be applied on component.

Schema Examples

{
id :'', //auto generates by defaults
type: 'bar/line',//default bar (external
data: [{ //default [] (external)
label: 'JAN',
items: [
{
label: 'Day1',
value: 70
},
{
label: 'Day7',
value: 80
}
]
},
{
label: 'FEB',
items: [
{
label: 'Day1',
value: 90
},
{
label: 'Day7',
value: 50
}
]
}, {
label: 'MAR',
items: [
{
label: 'Day1',
value: 40
},
{
label: 'Day7',
value: 30
}
]
}
],
dataAPI:{ //loader till chart shown, onDataFormatSingleChart called before using data
method:'GET',//default
url:'',
body:{}
},
options: {
labels:{
xAxis:'Months', //custom color UI
yAxis:'Count', //custom color UI
values:['Day1','Day7'] //data set & on hover labels
},
title:'',
yAxis: {
startValue: 0,
endValue: 100,
stepValue: 10
},
},
onClick: 'onClickSingleChart',
dataFormatCallback: 'onDataFormatSingleChart',
elmInstance:'',
subFeatureFlag:{
},
subAccessCtrl:{
},
subTheme:{
},
subFont:{
},
subStyle:{
},
subRawAttributes:{
class: ''
}
}