You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: components/chart/types/pie.md
+113-7Lines changed: 113 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -73,13 +73,11 @@ Pie series
73
73
}
74
74
````
75
75
76
-
## Pie Chart Specific Appearance Settings
77
-
78
-
### Rotation
76
+
## Rotation
79
77
80
78
By default, the first segment starts at the top. You can change that by using the `StartAngle` property of the series.
81
79
82
-
###Color Field
80
+
## Color Field
83
81
84
82
You can control the color of the individual segments of the pie chart by providing a string with the desired color in the model, and setting the `ColorField` of the series to it. You can pass a valid CSS color (for example, `#abcdef`, `#f00`, or `blue`).
85
83
@@ -131,7 +129,7 @@ Set color to the pie chart items
131
129
}
132
130
````
133
131
134
-
###Exploded Segment
132
+
## Exploded Segment
135
133
136
134
You can have some of the segments of the pie separated from the rest of the circle with a small margin. This helps bring attention to them as outliers or as important bits that the viewer should focus on.
137
135
@@ -185,7 +183,7 @@ Separate items from the main body of the chart
185
183
}
186
184
````
187
185
188
-
###Visible In Legend
186
+
## Visible In Legend
189
187
190
188
You can hide certain segments from the legend (for example, if their contribution is insignificantly small). To do this, add a boolean field to the model and set its name to the `VisibleInLegendField` property of the pie series. The flags in this field will denote whether the particular item will be rendered in the legend.
191
189
@@ -242,10 +240,118 @@ Show only some items in the legend
242
240
}
243
241
````
244
242
243
+
## Width and Height
244
+
245
+
The main part of the Pie Chart is a circle. Thus, you may need to set both the `Width` and `Height` parameters to achieve the desired layout and dimensions. By default, the Chart container `<div>` expands horizontally to 100% and the height is set to `"400px"` in the CSS theme.
246
+
247
+
>caption Setting Pie Chart Width and Height
248
+
249
+
````CSHTML
250
+
Chart Width
251
+
<TelerikDropDownList Data="@ChartDimensions"
252
+
Value="@ChartWidth"
253
+
ValueChanged="@( async (string newValue) => {
254
+
ChartWidth = newValue;
255
+
await RefreshChart();
256
+
} )"
257
+
DefaultText="100%"
258
+
Width="120px" />
259
+
Chart Height
260
+
<TelerikDropDownList Data="@ChartDimensions"
261
+
Value="@ChartHeight"
262
+
ValueChanged="@( async (string newValue) => {
263
+
ChartHeight = newValue;
264
+
await RefreshChart();
265
+
} )"
266
+
Width="120px" />
267
+
268
+
Chart Legend Position
269
+
<TelerikDropDownList Data="@ChartLegendPositions"
270
+
@bind-Value="@ChartLegendPosition"
271
+
Width="120px" />
272
+
273
+
<TelerikChart @ref="ChartRef"
274
+
Width="@ChartWidth"
275
+
Height="@ChartHeight"
276
+
Class="chart-border">
277
+
<ChartSeriesItems>
278
+
<ChartSeries Type="ChartSeriesType.Pie"
279
+
Data="@PieData"
280
+
Field="@nameof(PieChartModel.Value)"
281
+
CategoryField="@nameof(PieChartModel.Category)">
282
+
</ChartSeries>
283
+
</ChartSeriesItems>
284
+
285
+
<ChartTitle Text="Revenue per product"></ChartTitle>
0 commit comments