public static void InitializeHorizontalStackedBar(GraphHorizBarChart chart) { chart.StackedType = Stacked.Normal; chart.Gallery = Gallery.Gantt; chart.Font = new System.Drawing.Font("Arial", 9); chart.Width = 580; chart.Height = 370; LegendItemAttributes lia = new LegendItemAttributes(); lia.Inverted = true; chart.LegendBox.ItemAttributes[chart.Series] = lia; chart.LegendBox.Dock = ChartFX.WebForms.DockArea.Bottom; chart.LegendBox.Border = 0; chart.LegendBox.ContentLayout = ChartFX.WebForms.ContentLayout.Center; chart.LegendBox.AutoSize = false; chart.LegendBox.Height = 90; chart.LegendBox.Width = (int)chart.Width.Value - 30; chart.LegendBox.MarginX = 0; chart.LegendBox.MarginY = 0; // plotareaonly = false means that the legend box will not flow outside of the chart area // however this doesn't mean that the legend itself will not flow outside of the legendbox // and therefore have hidden legend items. chart.LegendBox.PlotAreaOnly = false; chart.AxisX.Grids.Major.Visible = false; chart.AxisX.Inverted = true; chart.Background = new SolidBackground(); ((SolidBackground)chart.Background).Color = System.Drawing.Color.White; chart.Border = new ChartFX.WebForms.Adornments.SimpleBorder(); chart.Border.Color = System.Drawing.Color.Black; }
private void SetLegendInvertedStatus(StackedType type) { LegendItemAttributes liatt = new LegendItemAttributes(); this.LegendBox.ItemAttributes[Series] = liatt; switch (type) { case StackedType.No: liatt.Inverted = false; break; case StackedType.Normal: case StackedType.Stacked100: liatt.Inverted = true; break; } }