Skip to main content

Chart Bar Hds

<sl-chart-bar-hds> | SlChartBarHds
Since 2.0 experimental

Bar chart to display data in a bar format.

<sl-chart-bar-hds id="hds-bar-chart"></sl-chart-bar-hds>
<script>
    const barChart = document.getElementById('hds-bar-chart');
    barChart.data = [
      { label: 'Company Area', value: 30000, href: 'https://google.com/' },
      { label: 'Finance', value: 70000, href: 'https://google.com/' },
      { label: 'Accounting', value: 50000, href: 'https://google.com/' },
      { label: 'Asia', value: 28000, href: 'https://google.com/' },
      { label: 'Another Vector', value: 10000, href: 'https://google.com/' },
      { label: 'Yet Another Vector', value: 20000, href: 'https://google.com/' },
    ];
    barChart.isResponsive = false
    barChart.height = 400
    barChart.chartTitle = 'Accounting Break Down'
    barChart.theme = 'default'
    barChart.isHorizontal = true
  </script>

Examples

First Example

TODO

Second Example

TODO

[component-metadata:sl-chart-bar-hds]

Slots

Name Description
(default) The default slot.
example An example slot.

Learn more about using slots.

Properties

Name Description Reflects Type Default
data Data to populate the Chart DataPoint[] []
chartTitle
chart-title
Title of the Chart string ''
valuePrefix
value-prefix
Prefix for the value string ''
height chart height number 500
theme Theme of the chart ‘default’, ‘light’, ‘dark’, ‘custom’ string 'default'
themeColors
theme-colors
Custom theme colors. Must set theme to ‘custom’ for this to work array []
isResponsive
responsive
Responsive chart boolean false
showLegend
show-legend
Show legend boolean true
showXAxis
show-x-axis
Show the X Axis of the chart. boolean true
showYAxis
show-y-axis
Show the Y Axis of the chart. boolean true
updateComplete A read-only promise that resolves when the component has finished updating.

Learn more about attributes and properties.

Events

Name React Event Description Event Detail
sl-event-name Emitted as an example. -

Learn more about events.

Custom Properties

Name Description Default
--example An example CSS custom property.

Learn more about customizing CSS custom properties.

Parts

Name Description
base The component’s base wrapper.

Learn more about customizing CSS parts.

Dependencies

This component automatically imports the following dependencies.

  • <sl-example>
  • <sl-popover-hds>