# Blazor Stock Chart Overview

The <a href = "https://www.telerik.com/blazor-ui/stock-chart" target="_blank">Blazor Stock Chart component</a> allows you to visualize the deviation of a financial unit over a period of time to the user in a meaningful way so they can draw conclusions. You can use a variety of chart types and control all aspects of the chart's appearance - from colors and fonts, to paddings, margins, tooltips and templates.

The Telerik Stock Chart provides a [Navigator](https://www.telerik.com/blazor-ui/documentation/components/stockchart/navigator) to widen or shorten the defined period of time and zoom on particular part of the chart; and a [crosshair](https://www.telerik.com/blazor-ui/documentation/components/stockchart/crosshairs) to see precise values in data-dense charts.

## Creating Stock Chart

1. Add the `TelerikStockChart` tag to your razor page.
2. Set the `DateField` parameter of the `TelerikStockChart` to the corresponding property of the model for the [`OHLC`](https://www.telerik.com/blazor-ui/documentation/components/stockchart/types/ohlc) and the [`Candlestick`](https://www.telerik.com/blazor-ui/documentation/components/stockchart/types/candlestick) StockChart types.
3. Provide [data](https://www.telerik.com/blazor-ui/documentation/components/stockchart/data-bind) to the series.
4. (optional) Enable the [navigator](https://www.telerik.com/blazor-ui/documentation/components/stockchart/navigator) by including its `StockChartNavigator` tag and adding a series that mirrors the main chart data to it.

> caption Basic configuration of a Stock Chart with common settings

<demo metaUrl="client/stockchart/overview/example-1/" height="520"></demo>

### Customize Chart Elements - Nested Tags Settings

When configuring nested properties and child elements in your chart, the inner tags will contain their parent tag name and add specifics to its end. In general the structure of such nested tags will be `<StockChart*Category**Specifics*>` where the Category can be one of the following:

* CategoryAxis
* ChartArea
* Legend
* Navigator
* PlotArea
* SeriesItems
* Title
* Tooltip
* ValueAxis
* and others

> tip To customize the chart, look for nested tags and their properties - the inner tags will contain their parent tag name and add specifics to its end. For example, the `StockChartSeries` tag has a `StockChartSeriesTooltip` tag that exposes configuration options and more child tags.

You can customize all aspects of the stock chart by using the settings provided by the nested tags.

For example:

`StockChartCategoryAxes` > `StockChartCategoryAxis` > `StockChartCategoryAxisLabels` tags

This approach can be used with all tags that are applicable for the Chart type.

## Stock Chart Size

To control the size of the StockChart, use the `Width` and the `Height` parameters.

You can also set the chart size in percentage values so it occupies its container when it renders. If the parent container size changes, you must call the chart's `Refresh()` C# method after the DOM has been redrawn and the new container dimensions are rendered. You can do this when you explicitly change container sizes (like in the example below), or from code that gets called by events like `window.resize`. You can find an example of making charts redraw on `window.resize` in the [Responsive Chart](https://github.com/telerik/blazor-ui/tree/master/chart/responsive-chart) sample.

> caption Change the 100% chart size dynamically to have a responsive chart

<demo metaUrl="client/stockchart/overview/example-2/" height="520"></demo>

## StockChart Parameters

The following table lists StockChart parameters, which are not discussed elsewhere in the component documentation.

<style>
    .article table {
        table-layout: auto;
        word-break: normal;
    }
</style>

| Parameter     | Type and Default value          | Description                                                             |
| ------------- | ------------------------------- | ----------------------------------------------------------------------- |
| `Width`       | `string`                        | Controls the width of the StockChart.                                   |
| `Height`      | `string`                        | Controls the height of the StockChart.                                  |
| `Class`       | `string`                        | Renders a custom CSS class on the `<div class="k-stockchart">` element. |
| `Transitions` | `bool?`                         | Controls if the StockChart renders animations.                          |
| `RenderAs`    | `RenderingMode?` <br /> (`SVG`) | Controls if the StockChart renders as `SVG` or `Canvas`.                |

## Component Reference and Methods

To execute StockChart methods, obtain reference to the component instance via `@ref`.

| Method  | Description                                                          |
| ------- | -------------------------------------------------------------------- |
| Refresh | You can use that method to programmatically re-render the component. |

## Next Steps

* [Bind Data to the StockChart](https://www.telerik.com/blazor-ui/documentation/components/stockchart/data-bind)
* [Explore the Navigator](https://www.telerik.com/blazor-ui/documentation/components/stockchart/navigator)
* [Learn more about the Crosshair](https://www.telerik.com/blazor-ui/documentation/components/stockchart/crosshairs)

## See Also

* [Live Demos: Stock Chart](https://demos.telerik.com/blazor-ui/stockchart/overview)
* [StockChart API Reference](https://www.telerik.com/blazor-ui/documentation/api/telerik.blazor.components.telerikstockchart)
