Show or hide chart legend

Posted by: saint168 on 19 September 2017, 1:22 am EST

    • Post Options:
    • Link

    Posted 19 September 2017, 1:22 am EST

    Is there a way to show or hide the chart legend from the code behind? I have a small pie chart on the screen and user can click on it to zoom in. I would like to show the legend only when the chart is zoomed in. However, I am not able to find a reference to the legend object from the c1chart object.

    Thank you

  • Posted 19 September 2017, 1:22 am EST

    Hello,

    Add name to the legend in xaml and then you can change its visibility in code: legend.Visibility = ...







    ...

    --

    Best regards,

    Alex

  • Posted 15 March 2023, 1:56 am EST

    not working for me

  • Posted 15 March 2023, 1:56 am EST

    [code]**********************************************[/code]
  • Posted 19 March 2023, 8:43 pm EST

    Hi,

    You can show or hide FlexPie/FlexChart legend by setting LegendPosition property as:

            private void LegendChecked_Changed(object sender, RoutedEventArgs e)
            {
                if((sender as CheckBox).IsChecked.Value)
                    flexPie.LegendPosition = C1.Chart.Position.Auto;
                else
                    flexPie.LegendPosition = C1.Chart.Position.None;
            }

    Please refer the attached sample for the same: FlexPieDemo.zip

    Best Regards,

    Nitin

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels