How to add dropdown list to limit number of element to be display in chart

Hello,

I found your chart very useful. However, it is very dense to display many elements in one chart. 

1 - Is it possible to add dropdownlist filled with chart elements for users to select elements (multiple select) they want to display?

2 - Is it possible to add multiple charts series from the list to connect to the server and refresh to display the selected element in the dropdown list?

3 - Would appreciate it if you could provide an example covering the above question.


Sao








1 Reply

DG Durga Gopalakrishnan Syncfusion Team August 8, 2022 02:13 PM UTC

Hi Sao,


Greetings from Syncfusion.


We suggest you to use multiselect dropdown and chart RefreshAsync method to update the chart series based on selected values. We have prepared sample based on your requirement. Please check with the below screenshot and sample.


@code {

  SfChart chartObj;

  private void ValueChangeHandler(MultiSelectChangeEventArgs<string[]> args)

    {

        var values = args.Value;

        if (values != null)

        {

            for (var i = 0; i < values.Length; i++)

            {

                if (values[i].ToString() == "1")

                {

                    ChartPoints1 = new List<CombinationSeriesData>

                    {

                    new CombinationSeriesData { x = "2005", y = 1.2},

                    new CombinationSeriesData { x = "2006", y = 1 }

                    //…

                    };    

                }

        else

        {

             ChartPoints1  = new List<CombinationSeriesData> { };

             //…

       }

        chartObj.RefreshAsync();

   }





Sample : https://www.syncfusion.com/downloads/support/directtrac/general/ze/MultiSelectSeries1856770105.zip


Please let us know if you have any concerns.


Regards,

Durga Gopalakrishnan.


Loader.
Up arrow icon