public override void DataBind() { if (!Visible) // don't databind if we aren't going to use it. { return; } DataTable table = getTableFromObject(DataSource); //Normalize RaceLabelNames: Replace Old Race Labels with New labels: ReplaceOldRaceLabelsWithNew(table); //backwards compatibility if (SeriesColumnName == ColumnPicker.CommonGraphNames.OrgSchoolTypeLabel.ToString() && !table.Columns.Contains(ColumnPicker.CommonGraphNames.OrgSchoolTypeLabel.ToString())) { SeriesColumnName = "OrgLevelLabel"; } SaveOriginalAxisAndSeriesLabels(table); table = SortDataSource(table); table = TransformDataSource(table); GraphBarChart.OverrideSeriesColumnNames(table, customSeriesLabelsMap); GraphBarChart.ReplaceColumnValues(table, LabelColumnName, OverrideAxisXLabels); DataSource = table; base.DataBind(); GraphHorizBarChart.SetSeriesColors(this.Series, SeriesColors); SetSeriesPatterns(this.Series, OverrideSeriesPatterns); }
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; }
protected override void OnInit(EventArgs e) { base.OnInit(e); //default Type = StackedType.No; YAxisSuffix = "%"; System.Drawing.Font myFont = new System.Drawing.Font("Arial", 9); this.Font = myFont; this.Gallery = Gallery.Bar; this.Width = 580; this.Height = 370; this.LegendBox.Dock = ChartFX.WebForms.DockArea.Bottom; this.LegendBox.Border = 0; this.LegendBox.ContentLayout = ChartFX.WebForms.ContentLayout.Center; this.LegendBox.AutoSize = true; // this.LegendBox.Height = 60; // this.LegendBox.Width = 530; this.LegendBox.MarginX = 0; this.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. this.LegendBox.PlotAreaOnly = false; // this.AxisY.LabelsFormat.IsPercentage.Equals(true); // this.Font.Bold.Equals(true); // this.LegendBox.Border.Equals(1); //this.LegendBox.Height = 60; //this.LegendBox.Width = 600; //this.LegendBox.MarginX = 38; //this.LegendBox.ContentLayout = ChartFX.WebForms.ContentLayout.Near; //this.LegendBox.PlotAreaOnly = false; //end ht test this.AxisX.Grids.Major.Visible = false; ChartFX.WebForms.Adornments.SolidBackground solidBackground = new ChartFX.WebForms.Adornments.SolidBackground(); solidBackground.Color = System.Drawing.Color.White; ChartFX.WebForms.Adornments.SimpleBorder simpleBorder = new ChartFX.WebForms.Adornments.SimpleBorder(); simpleBorder.Color = System.Drawing.Color.Black; this.Background = solidBackground; this.Border = simpleBorder; GraphHorizBarChart.SetSeriesColors(this.Series, null); }