Home > Blockchain >  How can i disable series animation in highchart tree map?
How can i disable series animation in highchart tree map?

Time:01-24

I wrote the following code to disable the series animation :

Animation = new Animation{Enabled = false},

But after runing my application , the problem still persists. My code to display the treemap is as follows:

@{ var chartOptions =
                                                                             new Highcharts
                                                                             {
                                                                                    Title = new Title
                                                                                 {
                                                                                     Text = ""
                                                                                 },
                                                                                 Credits = new Credits
                                                                                 {
                                                                                     Enabled = false
                                                                                 },
                                                                                 Series = new List<Series>
                                                  {
                                                new TreemapSeries
                                         {

                                             Animation = new Animation{Enabled = false},
                                             LayoutAlgorithm = TreemapSeriesLayoutAlgorithm.Squarified,

                                             AlternateStartingDirection = true,
                                             Levels = new List<TreemapSeriesLevels>
                                                             {
                                                new TreemapSeriesLevels
                                                {
                                                    Level = 1,
                                                    LayoutAlgorithm = TreemapSeriesLevelsLayoutAlgorithm.Squarified,
                                                    
                                                    DataLabels = new TreemapSeriesDataLabels()
                                                    {
                                                        Enabled = true,
                                                        Align = TreemapSeriesDataLabelsAlign.Left,
                                                        VerticalAlign = TreemapSeriesDataLabelsVerticalAlign.Top
                                                    }
                                                }
                                             },

                                             Data =  @ViewBag.resultGreen
                                             ,

                                         }
                                          }

                                                                             };

                chartOptions.ID = "chart";
                chartOptions.PlotOptions.Series.Animation.Enabled = false;

                var renderer = new HighchartsRenderer(chartOptions);
            }

            @Html.Raw(renderer.RenderHtml())

How can i solve this problems?

I tried to solve this problem by the link below:

How to disable animations on Highcharts Dotnet C# MVC?

CodePudding user response:

The provided answer in the mentioned thread looks to be related to DotNet.Highcharts. If you use the official Highcharts .NET wrapper use the AnimationBool option:

            new TreemapSeries
            {
                AnimationBool = false,
                ...
            }

API Reference: https://dotnet.highcharts.com/Help/Highcharts/html/class_highsoft_1_1_web_1_1_mvc_1_1_charts_1_1_treemap_series.html#a3b53a65560c6917e7ee52e1779335b2e

  • Related