# Bar Plot

## Introduction

This is a normal bar plot that is drawn according to the linear data sets provided in the input of the functions. We can have both custom string labels and library-calculated labels in this type of plot.

{% hint style="warning" %}
Warning:- Similar to all the other linear plots, bar plots can also have more than one linear Data Set object in its list, however, it is not recommended since the UI becomes cluttered.
{% endhint %}

<div><figure><img src="https://4163479044-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBOqdmtNSHPd43dHfAUCG%2Fuploads%2FGcZyghKTNPQmLZmQGTdw%2FBar%20Plot.png?alt=media&#x26;token=eb43a856-d938-43f2-89b4-7debd9ac3c76" alt="" width="375"><figcaption><p>Bar Plot</p></figcaption></figure> <figure><img src="https://4163479044-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBOqdmtNSHPd43dHfAUCG%2Fuploads%2FQlHLW875fCC8TqBdcELs%2FBar%20String%20Plot.png?alt=media&#x26;token=58890579-66f1-4cc3-8df1-0af0b114a4fa" alt="" width="375"><figcaption><p>String Bar Plot</p></figcaption></figure></div>

## Code Example

According to the number of Linear Data Sets in the list, the plot shows the bars for all the data sets respectively.

If you provide a single linear data set, only **one bar plot** is created. Similarly, if you provide two coordinate sets then **two bar plots** will be created and so on.

*Example of a bar plot with a list of linear data set objects :-*&#x20;

```kotlin
// X Axis Labels Example
val xAxisLabels = listOf("Jan" , "Feb" , "Mar").toCoordinateSet()

// This function creates the Bar Plot.
BasicLinearStrategy.BarPlot(
    linearData = BasicDataStrategy(
        linearDataSets = linearDataSet1,
        xAxisLabels = xAxisLabels
    )
)
```

{% hint style="info" %}
You can also have custom string labels in bar plots. For more information on how you can implement them, head over to the page linked below.
{% endhint %}

{% content-ref url="string-label-line-plot" %}
[string-label-line-plot](https://dev-anirban.gitbook.io/jetchart/plot-tool-kit/linear-plots/string-label-line-plot)
{% endcontent-ref %}
