@@ -109,52 +109,116 @@ Steps for drawing vertical and horizontal lines with [plot bands]({%slug chart-p
109
109
}
110
110
`````
111
111
112
- ### Using Additional Line Series
112
+ ### Using Additional ScatterLine Series
113
113
114
- Steps for drawing horizontal and vertical lines with additional [ Lines Series] ({%slug components/chart/types/line %}):
114
+ Steps for drawing horizontal and vertical lines with additional [ ScatterLine Series] ({%slug components/chart/types/scatterline %}):
115
115
116
- 1 . Add ` ChartSeries ` instances of type ` ChartSeriesType.Line ` based on the needed number of lines.
116
+ 1 . Add ` ChartSeries ` instances of type ` ChartSeriesType.ScatterLine ` based on the needed number of lines.
117
117
2 . Set data for the lines based on the information shown from the main Chart.
118
118
119
- > caption Drawing Horizontal and Vertical lines with additional Lines Chart
119
+ > caption Drawing Horizontal and Vertical lines with additional ScatterLine Chart
120
120
121
121
```` CSHTML
122
122
<TelerikChart>
123
+ <ChartLegend Visible="true"></ChartLegend>
124
+
123
125
<ChartSeriesItems>
124
- <ChartSeries Type="ChartSeriesType.Column" Name="Column 1" Data="@firstColumnTypeData">
125
- </ChartSeries>
126
- <ChartSeries Type="ChartSeriesType.Column" Name="Column 2" Data="@secondColumnTypeData">
126
+ <ChartSeries Type="ChartSeriesType.Scatter"
127
+ Data="@SeriesScatterData"
128
+ Name="Scatter"
129
+ XField="@nameof(ModelData.X)"
130
+ YField="@nameof(ModelData.Y)">
127
131
</ChartSeries>
128
- <ChartSeries Type="ChartSeriesType.Line" Name="Line 1" Data="@firstLineTypeData">
132
+
133
+ <ChartSeries Type="ChartSeriesType.Bubble"
134
+ Data="@SeriesBubbleData"
135
+ Name="Bubble"
136
+ XField="@nameof(ModelData.X)"
137
+ YField="@nameof(ModelData.Y)"
138
+ SizeField="@nameof(BubbleData.SizeField)">
129
139
</ChartSeries>
130
- <ChartSeries Type="ChartSeriesType.Line" Name="Line 2" Data="@secondLineTypeData">
140
+
141
+ <ChartSeries Type="ChartSeriesType.ScatterLine"
142
+ Data="@Series1Data"
143
+ Name="Line"
144
+ XField="@nameof(ModelData.X)"
145
+ YField="@nameof(ModelData.Y)">
146
+ <ChartSeriesMarkers Visible="false" />
131
147
</ChartSeries>
132
- </ChartSeriesItems>
133
148
134
- <ChartCategoryAxes>
135
- <ChartCategoryAxis Categories="@xColumnAxisItems"></ChartCategoryAxis>
136
- </ChartCategoryAxes>
149
+ <ChartSeries Type="ChartSeriesType.ScatterLine"
150
+ Data="@Series2Data"
151
+ Name="Dashed Line"
152
+ XField="@nameof(ModelData.X)"
153
+ YField="@nameof(ModelData.Y)"
154
+ DashType="@DashType.Dash">
155
+ <ChartSeriesMarkers Visible="false" />
156
+ </ChartSeries>
137
157
138
- <ChartTitle Text="Draw Horizontal and Vertical Lines"></ChartTitle>
158
+ <ChartSeries Type="ChartSeriesType.ScatterLine"
159
+ Data="@Series3Data"
160
+ Name="Dotted Line"
161
+ XField="@nameof(ModelData.X)"
162
+ YField="@nameof(ModelData.Y)"
163
+ DashType="@DashType.Dot">
164
+ <ChartSeriesMarkers Visible="false" />
165
+ </ChartSeries>
139
166
140
- <ChartLegend Position="ChartLegendPosition.Right">
141
- </ChartLegend>
167
+ </ChartSeriesItems>
142
168
</TelerikChart>
143
169
144
170
@code {
145
- #region LinesData
146
- private List<object> firstColumnTypeData = new List<object>() { 10, 2, 5, 6 };
147
- private List<object> secondColumnTypeData = new List<object>() { 5, 8, 2, 7 };
171
+ public class ModelData
172
+ {
173
+ public int X { get; set; }
174
+ public int Y { get; set; }
175
+ }
176
+ public class BubbleData
177
+ {
178
+ public int X { get; set; }
179
+ public int Y { get; set; }
180
+ public int SizeField { get; set; }
181
+ }
182
+
183
+ public List<ModelData> Series1Data = new List<ModelData>()
184
+ {
185
+ new ModelData() { X = 120, Y = 0 },
186
+ new ModelData() { X = 120, Y = 100 },
187
+ };
148
188
149
- private List<object> firstLineTypeData = new List<object>() { 8, 8, 8, 6 };
150
- private List<object> secondLineTypeData = new List<object>() { 5, 8, 2, 7 };
189
+ public List<ModelData> Series2Data = new List<ModelData>()
190
+ {
191
+ new ModelData() { X = 0, Y = 20 },
192
+ new ModelData() { X = 140, Y = 20 },
193
+ };
151
194
152
- private string[] xColumnAxisItems = new string[] { "Q1", "Q2", "Q3", "Q4" };
153
- #endregion
195
+ public List<ModelData> Series3Data = new List<ModelData>()
196
+ {
197
+ new ModelData() { X = 0, Y = 80 },
198
+ new ModelData() { X = 140, Y = 80 },
199
+ };
200
+
201
+ public List<BubbleData> SeriesBubbleData = new List<BubbleData>()
202
+ {
203
+ new BubbleData() { X = 40, Y = 40 , SizeField=1000},
204
+ new BubbleData() { X = 66, Y = 77 , SizeField=500},
205
+ new BubbleData() { X = 90, Y = 50 , SizeField=200},
206
+ new BubbleData() { X = 120, Y = 70 , SizeField=350}
207
+ };
208
+
209
+ public List<ModelData> SeriesScatterData = new List<ModelData>()
210
+ {
211
+ new ModelData() { X = 10, Y = 10 },
212
+ new ModelData() { X = 17, Y = 50 },
213
+ new ModelData() { X = 18, Y = 70 },
214
+ new ModelData() { X = 35, Y = 90 },
215
+ new ModelData() { X = 47, Y = 95 },
216
+ new ModelData() { X = 100, Y = 100 }
217
+ };
154
218
}
155
219
````
156
220
157
221
## See Also
158
222
159
223
* [ Charts Plot Bands] ({%slug chart-plot-bands%})
160
- * [ Lines Chart] ( https://demos.telerik.com/blazor-ui/chart/line-chart )
224
+ * [ ScatterLine Chart] ( https://demos.telerik.com/blazor-ui/chart/scatter- line-chart )
0 commit comments