Skip to content

Commit 0d6cb78

Browse files
authored
feat(chart): add no data template documentation (#673)
1 parent 1150e33 commit 0d6cb78

File tree

1 file changed

+114
-0
lines changed

1 file changed

+114
-0
lines changed
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
---
2+
title: No Data Template
3+
page_title: No Data Template - RadHtmlChart
4+
description: Learn how to use the No Data Template of the RadHtmlChart.
5+
slug: htmlchart/functionality/no-data-template
6+
tags: no data, template, no data template, htmlchart, chart, telerik, kendo
7+
published: True
8+
position: 7
9+
---
10+
11+
# No Data Template
12+
13+
The Telerik WebForms Chart component allows to display a message when there is no data to show. This feature is particularly useful when loading data asynchronously, as it reassures users that data may appear after a delay.
14+
15+
Customizing the No Data Template is simple, enabling to add styling or interactive elements like buttons to improve usability. The No Data Template can be used for all [chart types]({% slug htmlchart/chart-types/overview %}). Here's how to set up a custom message for scenarios where the chart data is unavailable.
16+
17+
18+
## Example with Bar Chart
19+
20+
````ASP.NET
21+
<telerik:RadHtmlChart runat="server" ID="RadHtmlChart1" Width="1000px">
22+
<NoDataTemplate>
23+
<button onclick="onClick(); return false;">Refetch</button>
24+
</NoDataTemplate>
25+
<PlotArea>
26+
<Series>
27+
<telerik:ColumnSeries DataFieldY="nuclear" Name="Nuclear" />
28+
<telerik:ColumnSeries DataFieldY="hydro" Name="Hydro" />
29+
<telerik:ColumnSeries DataFieldY="wind" Name="Wind" />
30+
</Series>
31+
</PlotArea>
32+
</telerik:RadHtmlChart>
33+
````
34+
35+
````JavaScript
36+
function onClick() {
37+
let chart = $find("<%= RadHtmlChart1.ClientID %>").get_kendoWidget();
38+
let dataSource = [{
39+
"country": "Spain",
40+
"year": "2024",
41+
"unit": "GWh",
42+
"solar": 2578,
43+
"hydro": 26112,
44+
"wind": 32203,
45+
"nuclear": 58973
46+
}, {
47+
"country": "Spain",
48+
"year": "2023",
49+
"unit": "GWh",
50+
"solar": 508,
51+
"hydro": 30522,
52+
"wind": 27568,
53+
"nuclear": 55103
54+
}, {
55+
"country": "Spain",
56+
"year": "2022",
57+
"unit": "GWh",
58+
"solar": 119,
59+
"hydro": 29831,
60+
"wind": 23297,
61+
"nuclear": 60126
62+
}, {
63+
"country": "Spain",
64+
"year": "2021",
65+
"unit": "GWh",
66+
"solar": 41,
67+
"hydro": 23025,
68+
"wind": 21176,
69+
"nuclear": 57539
70+
}, {
71+
"country": "Spain",
72+
"year": "2020",
73+
"unit": "GWh",
74+
"solar": 56,
75+
"hydro": 34439,
76+
"wind": 15700,
77+
"nuclear": 63606
78+
}, {
79+
"country": "Spain",
80+
"year": "2019",
81+
"unit": "GWh",
82+
"solar": 41,
83+
"hydro": 43897,
84+
"wind": 12075,
85+
"nuclear": 61875
86+
}, {
87+
"country": "Spain",
88+
"year": "2018",
89+
"unit": "GWh",
90+
"solar": 30,
91+
"hydro": 26270,
92+
"wind": 9342,
93+
"nuclear": 63016
94+
}, {
95+
"country": "Spain",
96+
"year": "2017",
97+
"unit": "GWh",
98+
"solar": 24,
99+
"hydro": 43864,
100+
"wind": 6759,
101+
"nuclear": 63708
102+
}, {
103+
"country": "Spain",
104+
"year": "2016",
105+
"unit": "GWh",
106+
"solar": 18,
107+
"hydro": 31807,
108+
"wind": 4727,
109+
"nuclear": 62206
110+
}];
111+
112+
chart.setDataSource(dataSource);
113+
}
114+
````

0 commit comments

Comments
 (0)