Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(chart): Add documentation for range series types #1536

Merged
merged 51 commits into from
Jul 12, 2023
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
7bd5a38
docs(rangecharts): Initial commit
dimodi Jul 7, 2023
4267514
docs(chart): Polish and add articles
dimodi Jul 10, 2023
844c508
Update components/chart/types/rangearea.md
dimodi Jul 12, 2023
a3cee59
Update components/chart/types/area.md
dimodi Jul 12, 2023
b0b7493
Update components/chart/types/bar.md
dimodi Jul 12, 2023
47422f8
Update components/chart/types/column.md
dimodi Jul 12, 2023
fa5dbdd
Update components/chart/types/rangearea.md
dimodi Jul 12, 2023
f82b17c
Update components/chart/types/rangecolumn.md
dimodi Jul 12, 2023
2672618
Update components/chart/types/rangecolumn.md
dimodi Jul 12, 2023
0663f9c
Update components/chart/types/rangecolumn.md
dimodi Jul 12, 2023
a408b0f
Update components/chart/types/rangecolumn.md
dimodi Jul 12, 2023
5fb4510
Update components/chart/types/rangecolumn.md
dimodi Jul 12, 2023
6b4fe52
Update components/chart/types/rangearea.md
dimodi Jul 12, 2023
06798e0
Update components/chart/types/rangebar.md
dimodi Jul 12, 2023
77c56b4
Update components/chart/types/rangecolumn.md
dimodi Jul 12, 2023
425f23d
Update components/chart/types/rangearea.md
dimodi Jul 12, 2023
b2cf983
Update components/chart/types/rangearea.md
dimodi Jul 12, 2023
8fa0669
Update components/chart/types/rangearea.md
dimodi Jul 12, 2023
f1497a2
Update components/chart/types/rangecolumn.md
dimodi Jul 12, 2023
5e16522
Update components/chart/types/rangearea.md
dimodi Jul 12, 2023
775bd5d
Update components/chart/types/rangebar.md
dimodi Jul 12, 2023
13233fa
Update components/chart/types/rangecolumn.md
dimodi Jul 12, 2023
3965942
Update components/chart/types/rangearea.md
dimodi Jul 12, 2023
6865205
Update components/chart/types/rangearea.md
dimodi Jul 12, 2023
4c4e838
Update components/chart/types/rangearea.md
dimodi Jul 12, 2023
2cefa1b
Update components/chart/types/rangearea.md
dimodi Jul 12, 2023
18232f1
Update components/chart/types/rangearea.md
dimodi Jul 12, 2023
734f0a5
Update components/chart/types/rangearea.md
dimodi Jul 12, 2023
3e087e1
Update components/chart/types/rangearea.md
dimodi Jul 12, 2023
6a715bf
Update components/chart/types/rangearea.md
dimodi Jul 12, 2023
847f3d8
Update components/chart/types/rangearea.md
dimodi Jul 12, 2023
3c22c8e
Update components/chart/types/rangearea.md
dimodi Jul 12, 2023
81a595e
Update components/chart/types/rangebar.md
dimodi Jul 12, 2023
7c772c9
Update components/chart/types/rangearea.md
dimodi Jul 12, 2023
4466826
Update components/chart/types/rangebar.md
dimodi Jul 12, 2023
04efaef
Update components/chart/types/rangebar.md
dimodi Jul 12, 2023
7ec3348
Update components/chart/types/rangebar.md
dimodi Jul 12, 2023
fd95ff4
Update components/chart/types/rangebar.md
dimodi Jul 12, 2023
f4181f9
Update components/chart/types/rangecolumn.md
dimodi Jul 12, 2023
953cab1
Update components/chart/types/rangebar.md
dimodi Jul 12, 2023
4157d75
Update components/chart/types/rangebar.md
dimodi Jul 12, 2023
4855f59
Update components/chart/types/rangecolumn.md
dimodi Jul 12, 2023
c359ba6
Update components/chart/types/rangebar.md
dimodi Jul 12, 2023
e46c42b
Update components/chart/types/rangebar.md
dimodi Jul 12, 2023
3d6a888
Update components/chart/types/rangebar.md
dimodi Jul 12, 2023
3a25d50
Update components/chart/types/rangecolumn.md
dimodi Jul 12, 2023
a4b2dce
Update components/chart/types/rangecolumn.md
dimodi Jul 12, 2023
cbe9a06
Update components/chart/types/rangecolumn.md
dimodi Jul 12, 2023
0b4d615
Update components/chart/types/rangecolumn.md
dimodi Jul 12, 2023
bf26f73
Update components/chart/types/rangecolumn.md
dimodi Jul 12, 2023
3403e0b
address tips
dimodi Jul 12, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions components/chart/types/area.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ The <a href="https://www.telerik.com/blazor-ui/area-chart" target="_blank">Blazo

An Area chart emphasizes the volume of money, data or any other unit that the given series has encompassed. When backgrounds are semi-transparent, it lets the user clearly see where different sets of data overlap.

The Area Chart is similar to the [Range Area Chart]({%slug components/chart/types/rangearea%}), which allows the area to raise above the horizontal axis.

@[template](/_contentTemplates/chart/link-to-basics.md#understand-basics-and-databinding-first)

#### To create an area chart:
Expand Down
2 changes: 2 additions & 0 deletions components/chart/types/bar.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ The <a href="https://www.telerik.com/blazor-ui/bar-chart" target="_blank">Blazor

![bar chart](images/bar-chart.png)

The Bar Chart is similar to the [Range Bar Chart]({%slug components/chart/types/rangebar%}), which allows the bar to move away from the category axis.

@[template](/_contentTemplates/chart/link-to-basics.md#understand-basics-and-databinding-first)

#### To create a bar chart:
Expand Down
4 changes: 2 additions & 2 deletions components/chart/types/column.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ The <a href="https://www.telerik.com/blazor-ui/column-chart" target="_blank">Bla

![column chart](images/column-chart.png)

@[template](/_contentTemplates/chart/link-to-basics.md#understand-basics-and-databinding-first)
The Column Chart is similar to the [Range Column Chart]({%slug components/chart/types/rangecolumn%}), which allows the column's low end to start above the horizontal axis.

@[template](/_contentTemplates/date-inputs/general.md#format-placeholder)
@[template](/_contentTemplates/chart/link-to-basics.md#understand-basics-and-databinding-first)

#### To create a column chart:

Expand Down
205 changes: 205 additions & 0 deletions components/chart/types/rangearea.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,205 @@
---
title: Range Area
page_title: Chart - Range Area
description: Overview of the Range Area Chart for Blazor with a description of the common use cases and the different ways to data bind the chart. The article lists configuration options and provides Range Area Chart examples.
slug: components/chart/types/rangearea
tags: telerik,blazor,chart,rangearea
published: True
position: 0
---

# Range Area Chart

The <a href="https://www.telerik.com/blazor-ui/range-area-chart" target="_blank">Blazor Range Area Chart</a> shows the data as a colored area between two continuous lines that pass through points defined by pairs of `from` and `to` values. The graph between the border lines has a different customizable color for each series. The Range Area Chart is similar to the [Area Chart]({%slug components/chart/types/area%}), which can be regarded as a Range Area Chart with a constant `from` value of zero.

You can use the Range Area Chart to emphasize the difference between pairs of continuous value sequences.

By default, the series backgrounds are semi-transparent, which lets the user clearly see where different sets of data overlap.

@[template](/_contentTemplates/chart/link-to-basics.md#understand-basics-and-databinding-first)

## Creating Blazor Range Area Chart

1. Add a `ChartSeries` to the `ChartSeriesItems` collection.
2. Set its `Type` property to `ChartSeriesType.RangeArea`.
dimodi marked this conversation as resolved.
Show resolved Hide resolved
dimodi marked this conversation as resolved.
Show resolved Hide resolved
3. Provide a data collection to its `Data` property. You can use a [collection of arrays](#bind-range-area-series-to-collection-of-arrays) or a [collection of custom objects](#bind-range-area-series-to-custom-objects).
dimodi marked this conversation as resolved.
Show resolved Hide resolved
dimodi marked this conversation as resolved.
Show resolved Hide resolved
4. If the Range Area data is a collection of arrays, provide data for the `Categories` parameter of the `ChartCategoryAxis`.

### Bind Range Area Series to Collection of Arrays
dimodi marked this conversation as resolved.
Show resolved Hide resolved

In this case, set the `ChartSeries` `Data` parameter to a `List` of arrays or a jagged array (an array of arrays). The inner arrays should have two members - one for the lower `from` value, and one for the higher `to` value.

In addition, set the `Categories` parameter of the `ChartCategoryAxis` to `object[]`. The members of this array will be used as labels for the category axis in their respective order.
dimodi marked this conversation as resolved.
Show resolved Hide resolved

>caption Blazor Range Area Chart bound to arrays

````CSHTML
<TelerikChart>
<ChartSeriesItems>
<ChartSeries Name="Sydney"
Data="@SydneyData"
Type="ChartSeriesType.RangeArea">
</ChartSeries>
<ChartSeries Name="Sofia"
Data="@SofiaData"
Type="ChartSeriesType.RangeArea">
</ChartSeries>
</ChartSeriesItems>

<ChartCategoryAxes>
<ChartCategoryAxis Categories="@MonthNames" />
</ChartCategoryAxes>

<ChartTooltip Visible="true"></ChartTooltip>

<ChartTitle Text="Monthly Temperatures"></ChartTitle>

<ChartLegend Position="ChartLegendPosition.Right"></ChartLegend>
</TelerikChart>

@code {
// The RangeArea series Data can be any collection of arrays

private List<double[]> SydneyData { get; set; } = new List<double[]>
{
new double[] { 20, 27 },
new double[] { 19.9, 26.8 },
new double[] { 18.4, 25.7 },
new double[] { 15.3, 23.6 },
new double[] { 12.3, 20.9 },
new double[] { 10, 18.3 },
new double[] { 8.9, 17.9 },
new double[] { 9.7, 19.3 },
new double[] { 12.3, 21.6 },
new double[] { 14.6, 23.2 },
new double[] { 16.6, 24.2 },
new double[] { 18.4, 25.7 }
};

private double[][] SofiaData { get; set; } = new double[][]
{
new double[] { -3.8, 3.6 },
new double[] { -2.3, 6.5 },
new double[] { 1.1, 11.5 },
new double[] { 5.4, 16.7 },
new double[] { 9.9, 21.4 },
new double[] { 13.4, 25.3 },
new double[] { 15.3, 27.9 },
new double[] { 15.3, 28.4 },
new double[] { 11.1, 23.3 },
new double[] { 6.7, 17.6 },
new double[] { 2.2, 10.7 },
new double[] { -2.3, 4.6 }
};

private object[] MonthNames = new string[] {
"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sept", "Oct", "Nov", "Dec"
};
}
````

### Bind Range Area Series to Custom Objects
dimodi marked this conversation as resolved.
Show resolved Hide resolved

In this case, set the `ChartSeries` `Data` parameter to an `IEnumerable<T>`. Then, set the `FromField`, `ToField` and `CategoryField` parameters of the `ChartSeries` to properties of the `T` type.
dimodi marked this conversation as resolved.
Show resolved Hide resolved

>caption Blazor Range Area Chart bound to custom objects

````CSHTML
<TelerikChart>
<ChartSeriesItems>
<ChartSeries Name="Test Tube 1"
Data="@Tube1Data"
Type="ChartSeriesType.RangeArea"
FromField="@nameof(AreaDataPoint.LowValue)"
ToField="@nameof(AreaDataPoint.HighValue)"
CategoryField="@nameof(AreaDataPoint.Hour)">
</ChartSeries>
<ChartSeries Name="Test Tube 2"
Data="@Tube2Data"
Type="ChartSeriesType.RangeArea"
FromField="@nameof(AreaDataPoint.LowValue)"
ToField="@nameof(AreaDataPoint.HighValue)"
CategoryField="@nameof(AreaDataPoint.Hour)">
</ChartSeries>
</ChartSeriesItems>

<ChartTooltip Visible="true"></ChartTooltip>

<ChartTitle Text="Laboratory Measurements"></ChartTitle>

<ChartLegend Position="ChartLegendPosition.Right"></ChartLegend>
</TelerikChart>

@code {
private List<AreaDataPoint> Tube1Data { get; set; } = new List<AreaDataPoint>();

private List<AreaDataPoint> Tube2Data { get; set; } = new List<AreaDataPoint>();

protected override void OnInitialized()
{
var rnd = new Random();
var dataPointCount = 10;

for (int i = 1; i <= dataPointCount; i++)
{
Tube1Data.Add(new AreaDataPoint()
{
Hour = i,
LowValue = rnd.Next(5 * i, 10 * i),
HighValue = rnd.Next(15 * i, 20 * i + 5)
});

Tube2Data.Add(new AreaDataPoint()
{
Hour = i,
LowValue = rnd.Next(5 * (dataPointCount + 1 - i), 10 * (dataPointCount + 1 - i)),
HighValue = rnd.Next(15 * (dataPointCount + 1 - i), 20 * (dataPointCount + 1 - i))
});
}
}

public class AreaDataPoint
{
public int Hour { get; set; }
public int LowValue { get; set; }
public int HighValue { get; set; }
}
}
````


## Range Area Chart Specific Appearance Settings
dimodi marked this conversation as resolved.
Show resolved Hide resolved

### Color

The color of a series is controlled through the `Color` property that can take any valid CSS color (for example, `#abcdef`, `#f00`, or `blue`). The color control the fill color of the area.
dimodi marked this conversation as resolved.
Show resolved Hide resolved

You can control the color of the line itself separately by using the `Color` property of the nested `TelerikChartSeriesLine` tag.

@[template](/_contentTemplates/chart/link-to-basics.md#opacity-area-bubble)

### Missing Values

If *both* values in a range pair are missing or `null`, you can have the Chart work around this by setting the `MissingValues` property of the series to the desired behavior. Use a member of the `Telerik.Blazor.ChartSeriesMissingValues` enum:
dimodi marked this conversation as resolved.
Show resolved Hide resolved

* `Zero` - the default behavior. The two lines and the area between them will go to the 0 value mark.
dimodi marked this conversation as resolved.
Show resolved Hide resolved
* `Interpolate` - the lines and area will go through the interpolated values of the missing data points and connect to the next data points with a value.
dimodi marked this conversation as resolved.
Show resolved Hide resolved
* `Gap` - there will be empty space in the range area until the next pair of values.
dimodi marked this conversation as resolved.
Show resolved Hide resolved


### Line Style

You can render the lines between the points with different styles. The supported styles can be set via the `Style` property of the child `ChartSeriesLine` tag - it takes a member of `Telerik.Blazor.ChartSeriesLineStyle` enum:
dimodi marked this conversation as resolved.
Show resolved Hide resolved

* `Normal`—This is the default style. It produces a straight line between data points.
dimodi marked this conversation as resolved.
Show resolved Hide resolved
* `Step`—The style renders the connection between data points through vertical and horizontal lines. It is suitable for indicating that the value is constant between the changes.
* `Smooth`—This style causes the Area Chart to display a fitted curve through data points. It is suitable when the data requires to be displayed with a curve, or when you wish to connect the points with smooth instead of straight lines.

@[template](/_contentTemplates/chart/link-to-basics.md#configurable-nested-chart-settings)

@[template](/_contentTemplates/chart/link-to-basics.md#configurable-nested-chart-settings-categorical)


## See Also

* [Live Demo: Range Area Chart](https://demos.telerik.com/blazor-ui/chart/range-area-chart)
150 changes: 150 additions & 0 deletions components/chart/types/rangebar.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
---
title: Range Bar
page_title: Chart - Range Bar
description: Overview of the Range Bar Chart for Blazor with a description of the common use cases and the different ways to data bind the chart. The article lists configuration options and provides Range Bar Chart examples.
slug: components/chart/types/rangebar
tags: telerik,blazor,chart,rangebar
published: True
position: 0
---

# Range Bar Chart

The <a href="https://www.telerik.com/blazor-ui/range-bar-chart" target="_blank">Blazor Range Bar chart</a> displays data as horizontal bars whose position and length vary according to their values. You can use a Range Bar chart to show a comparison between several sets of data (for example, summaries of quantative or time data). Each series is automatically colored differently for easier reading. The Range Bar Chart is similar to the [Bar Chart]({%slug components/chart/types/bar%}). The latter can be regarded as a Range Bar Chart with a "low" ("from") value of zero.
dimodi marked this conversation as resolved.
Show resolved Hide resolved

@[template](/_contentTemplates/chart/link-to-basics.md#understand-basics-and-databinding-first)

## Creating Blazor Range Bar Chart

1. Add a `ChartSeries` to the `ChartSeriesItems` collection.
2. Set its `Type` property to `ChartSeriesType.RangeBar`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ambiguous "its"

dimodi marked this conversation as resolved.
Show resolved Hide resolved
3. Provide a data collection to its `Data` property. You can use a [collection of arrays](#bind-range-column-series-to-collection-of-arrays) or a [collection of custom objects](#bind-range-column-series-to-custom-objects).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ambiguous "its"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
3. Provide a data collection to its `Data` property. You can use a [collection of arrays](#bind-range-column-series-to-collection-of-arrays) or a [collection of custom objects](#bind-range-column-series-to-custom-objects).
3. Provide a data collection to its `Data` property. You can use a [collection of arrays](#binding-range-column-series-to-collection-of-arrays) or a [collection of custom objects](#binding-range-column-series-to-custom-objects).

dimodi marked this conversation as resolved.
Show resolved Hide resolved
4. If the Range Bar data is a collection of arrays, provide data for the `Categories` parameter of the `ChartCategoryAxis`.

### Bind Range Bar Series to Collection of Arrays
dimodi marked this conversation as resolved.
Show resolved Hide resolved

In this case, set the `ChartSeries` `Data` parameter to a `List` of arrays or a jagged array (an array of arrays). The inner arrays should have two members - one for the "low" ("from") value, and one for the "high" ("to") value.
dimodi marked this conversation as resolved.
Show resolved Hide resolved

In addition, set the `Categories` parameter of the `ChartCategoryAxis` to `object[]`. The members of this array will be used as labels for the category axis in their respective order.
dimodi marked this conversation as resolved.
Show resolved Hide resolved

>caption Blazor Range Bar Chart bound to arrays

````CSHTML
<TelerikChart>
<ChartTitle Text="Sleep Hours by Age"></ChartTitle>

<ChartSeriesItems>
<ChartSeries Type="ChartSeriesType.RangeBar" Data="@SleepData">
</ChartSeries>
</ChartSeriesItems>

<ChartCategoryAxes>
<ChartCategoryAxis Categories="@Categories"></ChartCategoryAxis>
</ChartCategoryAxes>

<ChartValueAxes>
<ChartValueAxis Min="4"></ChartValueAxis>
</ChartValueAxes>

<ChartTooltip Visible="true">
<Template>
@{
var dataItem = (int[])context.DataItem;
}
<span>@dataItem[0] - @dataItem[1] hours</span>
</Template>
</ChartTooltip>

</TelerikChart>

@code {
private List<int[]> SleepData = new List<int[]>() {
new int[] { 14, 17 },
new int[] { 12, 16 },
new int[] { 11, 14 },
new int[] { 10, 13 },
new int[] { 9, 12 },
new int[] { 8, 10 },
new int[] { 7, 9 },
new int[] { 7, 8 }
};

private string[] Categories = new string[] {
"0–3 m", "4-12 m", "1-2 y", "3-5 y", "6-12 y", "13-18 y", "18-60 y", "60+ y"
};
}
````

### Bind Range Column Series to Custom Objects
dimodi marked this conversation as resolved.
Show resolved Hide resolved

In this case, set the `ChartSeries` `Data` parameter to an `IEnumerable<T>`. Then, set the `FromField`, `ToField` and `CategoryField` parameters of the `ChartSeries` to properties of the `T` type.
dimodi marked this conversation as resolved.
Show resolved Hide resolved

>caption Blazor Range Bar Chart bound to custom objects

````CSHTML
<TelerikChart>
<ChartTitle Text="Sleep Hours by Age"></ChartTitle>

<ChartSeriesItems>
<ChartSeries Type="ChartSeriesType.RangeBar"
Data="@SleepData"
FromField="@(nameof(RangeBarModel.LowValue))"
ToField="@(nameof(RangeBarModel.HighValue))"
CategoryField="@(nameof(RangeBarModel.AgeGroup))">
</ChartSeries>
</ChartSeriesItems>

<ChartValueAxes>
<ChartValueAxis Min="4"></ChartValueAxis>
</ChartValueAxes>

<ChartTooltip Visible="true">
<Template>
@{
var dataItem = (RangeBarModel)context.DataItem;
}
<span>@dataItem.LowValue - @dataItem.HighValue hours</span>
</Template>
</ChartTooltip>

</TelerikChart>

@code {
private List<RangeBarModel> SleepData = new List<RangeBarModel>() {
new RangeBarModel { LowValue = 14, HighValue = 17, AgeGroup = "0-3 m" },
new RangeBarModel { LowValue = 12, HighValue = 16, AgeGroup = "4-12 m" },
new RangeBarModel { LowValue = 11, HighValue = 14, AgeGroup = "1-2 y" },
new RangeBarModel { LowValue = 10, HighValue = 13, AgeGroup = "3-5 y" },
new RangeBarModel { LowValue = 9, HighValue = 12, AgeGroup = "6-12 y" },
new RangeBarModel { LowValue = 8, HighValue = 10, AgeGroup = "13-18 y" },
new RangeBarModel { LowValue = 7, HighValue = 9, AgeGroup = "18-60 y" },
new RangeBarModel { LowValue = 7, HighValue = 8, AgeGroup = "60+ y" }
};

public class RangeBarModel
{
public string AgeGroup { get; set; }
public int LowValue { get; set; }
public int HighValue { get; set; }
}
}
````

## Range Bar Chart Specific Appearance Settings

dimodi marked this conversation as resolved.
Show resolved Hide resolved
### Color

The color of a series is controlled through the `Color` property that can take any valid CSS color (for example, `#abcdef`, `#f00`, or `blue`). The color control the fill color of the area.
dimodi marked this conversation as resolved.
Show resolved Hide resolved

@[template](/_contentTemplates/chart/link-to-basics.md#color-field-bar-column)

@[template](/_contentTemplates/chart/link-to-basics.md#gap-and-spacing)

@[template](/_contentTemplates/chart/link-to-basics.md#configurable-nested-chart-settings)

@[template](/_contentTemplates/chart/link-to-basics.md#configurable-nested-chart-settings-categorical)


## See Also

* [Live Demo: Range Bar Chart](https://demos.telerik.com/blazor-ui/chart/range-bar-chart)
Loading