Skip to content

Commit 4ffa2de

Browse files
committed
docs(Chart): Add documentation about bubble MinSize and MaxSize
1 parent 78dbe5b commit 4ffa2de

File tree

2 files changed

+75
-5
lines changed

2 files changed

+75
-5
lines changed

components/chart/types/bubble.md

Lines changed: 71 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,19 +93,86 @@ To use a Chart component with Bubble series:
9393

9494
## Bubble Sizing
9595

96-
The Chart component determines the physical size of each bubble automatically:
96+
By default, the Chart determines the physical size of each bubble automatically:
9797

98-
* The maximum bubble size is 20% of the smaller Chart dimension (width or height). This ensures that the largest bubbles do not occupy too much space.
99-
* The minimum bubble size is 2% of the smaller Chart dimension, but not less than `10px`. This ensures that even the smallest bubbles are perceivable and accessible. The smallest bubble size also depends on the largest `Size` value in the Chart series.
98+
* The maximum bubble diameter is 20% of the smaller Chart dimension (width or height). This ensures that the largest bubbles do not occupy too much space.
99+
* The minimum bubble diameter is 2% of the smaller Chart dimension, but not less than `10px`. This ensures that even the smallest bubbles are perceivable and accessible. The smallest bubble size also depends on the largest `Size` value in the Chart series.
100100
* All bubble sizes are set proportionately, as long as they comply with the preceding rules.
101101

102+
To change the minimum and maximum bubble diameter, use the `MinSize` and `MinSize` parameters of `<ChartSeries>`. In this case, the Chart component sets the diameter of the rendered bubbles based on:
103+
104+
* The absolute values of `MinSize` and `MaxSize`, which represent pixels.
105+
* The ratio between `MinSize` and `MaxSize`.
106+
* The ratio between the smallest and largest `Size` values in the series.
107+
102108
As a result of the above algorithms:
103109

104-
* Bubble sizing may not be linear if the ratio between the smallest and largest `Size` values is too big. For example, a 10-fold bubble size difference is achievable with a large-enough Chart, but a 100-fold size difference is not supported.
110+
* Bubble sizing may not look proportionate if the ratio between the smallest and largest `Size` value in the series is not consistent with the ratio between the current minimum and maximum allowed bubble size.
105111
* The Bubble Chart helps users compare bubble sizes in the same Chart instance, rather than between different instances. To compare bubbles from multiple series, define these series in the same Chart instance.
106112

107113
If you need to [improve the bubble size comparability across several Charts](slug:chart-kb-bubble-size), then use a dummy data item with a `Size` value that matches the maximum `Size` value in all Chart instances.
108114

115+
>caption Using default and custom Chart bubble sizes
116+
117+
````RAZOR
118+
<TelerikChart Width="1000px" Height="420px">
119+
120+
<ChartSeriesItems>
121+
<ChartSeries Type="ChartSeriesType.Bubble"
122+
Data="@BubbleData"
123+
Name="Custom Sizes"
124+
XField="@nameof(BubbleModel.XValue)"
125+
YField="@nameof(BubbleModel.YValue1)"
126+
SizeField="@nameof(BubbleModel.SizeValue)"
127+
CategoryField="@nameof(BubbleModel.SizeValue)"
128+
MinSize="1"
129+
MaxSize="200">
130+
<ChartSeriesLabels Visible="true">
131+
<ChartSeriesLabelsMargin Top="20" />
132+
</ChartSeriesLabels>
133+
</ChartSeries>
134+
<ChartSeries Type="ChartSeriesType.Bubble"
135+
Data="@BubbleData"
136+
Name="Default Sizes"
137+
XField="@nameof(BubbleModel.XValue)"
138+
YField="@nameof(BubbleModel.YValue2)"
139+
SizeField="@nameof(BubbleModel.SizeValue)"
140+
CategoryField="@nameof(BubbleModel.SizeValue)">
141+
<ChartSeriesLabels Visible="true">
142+
<ChartSeriesLabelsMargin Bottom="30" />
143+
</ChartSeriesLabels>
144+
</ChartSeries>
145+
</ChartSeriesItems>
146+
147+
</TelerikChart>
148+
149+
@code {
150+
private List<BubbleModel> BubbleData { get; set; } = new();
151+
152+
protected override void OnInitialized()
153+
{
154+
for (int i = 0; i <= 12; i++)
155+
{
156+
BubbleData.Add(new()
157+
{
158+
XValue = i + 1,
159+
YValue1 = i + 1,
160+
YValue2 = (i + 1) * 2,
161+
SizeValue = (int)Math.Pow(2, i)
162+
});
163+
}
164+
}
165+
166+
public class BubbleModel
167+
{
168+
public double XValue { get; set; }
169+
public double YValue1 { get; set; }
170+
public double YValue2 { get; set; }
171+
public int SizeValue { get; set; }
172+
}
173+
}
174+
````
175+
109176
## Bubble Chart Specific Appearance Settings
110177

111178
### Color

knowledge-base/chart-bubble-size.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ This KB answers the following questions:
3131

3232
## Solution
3333

34-
The [Bubble Chart sets the minimum and maximum bubble sizes automatically](slug:components/chart/types/bubble#bubble-sizing), depending on the Chart dimensions, and the smallest and largest `Size` values in all series in the Chart instance.
34+
The [Bubble Chart supports two algorithms to set the minimum and maximum bubble sizes](slug:components/chart/types/bubble#bubble-sizing):
35+
36+
* Automatically, depending on the Chart dimensions, and the smallest and largest `Size` values in all series in the Chart instance.
37+
* Based on the `<ChartSeries>` `MinSize` and `MaxSize` parameters.
3538

3639
To display comparable bubble sizes in multiple Charts:
3740

0 commit comments

Comments
 (0)