Skip to content

Commit 0f15077

Browse files
docs(chart): bubble series negative values and opacity
1 parent 8b0679a commit 0f15077

File tree

4 files changed

+50
-12
lines changed

4 files changed

+50
-12
lines changed

_contentTemplates/chart/link-to-basics.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,3 +123,9 @@ You can render the lines between the points with different styles. The supported
123123
![](images/line-chart-step-and-smooth.png)
124124
#end
125125

126+
#opacity-area-bubble
127+
### Opacity
128+
129+
You can control how transparent the series fill is through the `Opacity` property. `0` means a completely transparent series, and `1` means a completely opaque (non-transparent) fill. You can use decimal values to set the desired transparency (for example, `Opacity="0.3"`).
130+
#end
131+

components/chart/types/area.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,7 @@ The color of a series is controlled through the `Color` property that can take a
7272

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

75-
### Opacity
76-
77-
You can control how transparent the area fill is through the `Opacity` property. `0` means a completely opaque (non-transparent) series, and `255` means a completely transparent fill.
75+
@[template](/_contentTemplates/chart/link-to-basics.md#opacity-area-bubble)
7876

7977
### Missing Values
8078

components/chart/types/bubble.md

Lines changed: 43 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -104,23 +104,57 @@ The color of a series is controlled through the `Color` property that can take a
104104

105105
The `ColorField` can change the color of individual items. To use it, pass a valid CSS color to the corresponding field in the model and the chart will use its values instead of the `Color` parameter.
106106

107-
<!--
108107

109-
### Opacity
108+
@[template](/_contentTemplates/chart/link-to-basics.md#opacity-area-bubble)
110109

111-
You can control how transparent the bubble fill is through the `Opacity` property. `0` means a completely opaque (non-transparent) series, and `255` means a completely transparent fill.
112110

113-
-->
114-
115-
116-
<!--
117111
### Negative Values
118112

119113
Negative values are allowed for the X and Y fields, because they are plotted on standard numerical axes.
120114

121-
The size field should, generally, have positive values as it correlates to the physical size of the bubble. To render negativ values, set the `NegativeValuesVisible` parameter of the series to `true`. They will be calculated as if their values are positive. To distinguish one from the other, you can have negative items show up in a different color through the `NegativeColor` parameter of the serires.
115+
The size field should, generally, have positive values as it correlates to the physical size of the bubble. To render negative values, set the `Visible` parameter of the `ChartSeriesNegativeValues` tag of the series to `true`. Bubbles with negative size values will be calculated as if their sizes are positive. To distinguish one from the other, you can have negative items show up in a different color through the `Color` parameter of the `ChartSeriesNegativeValues` tag.
116+
117+
>caption Negative bubble size
118+
119+
````CSHTML
120+
@* Negative bubble sizes can showcase decreases in values and can render in different color than the rest of the series *@
121+
122+
<TelerikChart>
123+
124+
<ChartSeriesItems>
125+
<ChartSeries Type="ChartSeriesType.Bubble"
126+
Data="@SeriesData"
127+
XField="@nameof(ModelData.X)"
128+
YField="@nameof(ModelData.Y)"
129+
SizeField="@nameof(ModelData.Size)">
130+
<ChartSeriesNegativeValues Visible="true" Color="cyan"></ChartSeriesNegativeValues>
131+
<ChartSeriesLabels Visible="true" Template="#=dataItem.MetaData#"></ChartSeriesLabels>
132+
</ChartSeries>
133+
</ChartSeriesItems>
134+
135+
</TelerikChart>
136+
137+
@code {
138+
public class ModelData
139+
{
140+
public int X { get; set; }
141+
public int Y { get; set; }
142+
public int Size { get; set; }
143+
public string MetaData { get; set; }
144+
}
145+
146+
public List<ModelData> SeriesData = new List<ModelData>()
147+
{
148+
new ModelData() { X = 250, Y = 5000, Size = 50000 , MetaData = "positive size"},
149+
new ModelData() { X = 500, Y = 1100, Size = -760000, MetaData = "negative size" }
150+
};
151+
}
152+
````
153+
154+
>caption The result from the code snippet above
155+
156+
![](images/bubble-chart-negative-values.png)
122157

123-
-->
124158

125159
## See Also
126160

10 KB
Loading

0 commit comments

Comments
 (0)