This is a migrated thread and some comments may be shown as answers.

How to add ChartSeries to the ChartSeriesItems

3 Answers 168 Views
Charts
This is a migrated thread and some comments may be shown as answers.
Bert
Top achievements
Rank 1
Veteran
Bert asked on 04 May 2020, 03:21 PM

Hi,

 

i would like to add ChartSeries to the ChartSeriesItems. I have a grid where I select some data. For each selected record, I would like to add a scatterline to a chart. Is this possible?

 

Thanks

3 Answers, 1 is accepted

Sort by
0
Accepted
Marin Bratanov
Telerik team
answered on 04 May 2020, 04:44 PM

Hi Bert,

You can use a series descriptor class and iterate over a collection of it in order to create many series at once: https://docs.telerik.com/blazor-ui/knowledge-base/chart-dynamic-series. You can even bind the grid to such a collection to get the selected items out of it automatically through two-way binding: https://docs.telerik.com/blazor-ui/components/grid/selection/multiple#two-way-binding-of-selecteditems.

 

Regards,
Marin Bratanov
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
Bert
Top achievements
Rank 1
Veteran
answered on 06 May 2020, 01:28 PM

Hi Marin,

thanks for the answer. It works to add chartseries.

I have 1 more problem, when I clear my list with datapoints (_RawSpectraList), the previous drawed lines are not removed. How can I clear the chart and remove all lines?

 

 @foreach (PointSerie item in _RawSpectraList)
                        {

                            <ChartSeries Type="ChartSeriesType.ScatterLine"
                                         Name="@item.name"
                                         Data="@item.data"
                                         Style="ChartSeriesStyle.Normal"
                                         XField="X"
                                         YField="Y">
                                <ChartSeriesMarkers Visible="false" />
                            </ChartSeries>
                        }

0
Accepted
Marin Bratanov
Telerik team
answered on 06 May 2020, 02:22 PM

Hello Bert,

You can Follow the fix for this and also find a workaround in this page: https://feedback.telerik.com/blazor/1441685-cannot-clear-dynamically-created-series.

 

Regards,
Marin Bratanov
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Tags
Charts
Asked by
Bert
Top achievements
Rank 1
Veteran
Answers by
Marin Bratanov
Telerik team
Bert
Top achievements
Rank 1
Veteran
Share this question
or