Ejemplo n.º 1
0
        public SCChart AddLegend(string name, LegendOptions options = null)
        {
            if (string.IsNullOrWhiteSpace(name))
            {
                throw new Exception("Legend name cannot be empty.");
            }

            options ??= new LegendOptions();

            var legend = new Legend(name);

            Chart.Legends.Add(legend);

            options.SetupXtraChartLegend(this, legend);

            return(this);
        }
Ejemplo n.º 2
0
        public SCChart SetLegend(string name = null, LegendOptions options = null)
        {
            options ??= new LegendOptions();

            if (!string.IsNullOrWhiteSpace(name))
            {
                var legend = Chart.Legends[name];
                if (legend == null)
                {
                    throw new Exception($"Cannot find legend '{name}'.");
                }

                options.SetupXtraChartLegend(this, legend);
            }
            else
            {
                options.SetupXtraChartLegend(this, Chart.Legend);
            }

            return(this);
        }