/// <summary> /// Adds Statistics Denmark specific functionality for adding Legend. /// </summary> protected override void addLegend() { base.addLegend(); if (showLegend) { Legends.First().Font = Font.Small; Legends.First().ForeColor = ColorTranslator.FromHtml("#4c4c4c"); Legends.First().LegendStyle = LegendStyle.Table; if (!ChartTypes.Contains(SeriesChartType.Pie)) { Legends.First().TextWrapThreshold = 1000; } Legends.First().TableStyle = LegendTableStyle.Wide; if (!ChartTypes.Contains(SeriesChartType.Pie)) { float y = spaceUsedForTitle + space; float h = legendHeight; Legends.First().Position = new ElementPosition(0, y, 100, h); } else { Legends.First().LegendStyle = LegendStyle.Column; float top = spaceUsedForTitle + space + space; Legends.First().Position = new ElementPosition(50, top, 50, 100 - top - SpaceUsedForInfoText); } } }
/// <summary> /// Adds Statistics Denmark specific functionality for adjusting the chart for displaying a populations pyramid. /// This method is in most cases called by PxMenu itself when needed. /// </summary> protected override void adjustForPopulationPyramid() { base.adjustForPopulationPyramid(); if (showLegend) { ChartArea ca = ChartAreas.First(); Legends.First().Position.X = ca.InnerPlotPosition.X + pixels(5); } }
/// <summary> /// Override in derived class to add change Population Pyramids. /// You might wanna include execution of the base class. /// </summary> protected virtual void adjustForPopulationPyramid() { SaveImage(Stream.Null, ChartImageFormat.Png); if (showLegend) { if (Series.First().Name.ToLower() == MaleValueNameForPopulationPyramid.ToLower()) { Legends.First().LegendItemOrder = LegendItemOrder.ReversedSeriesOrder; } else { Legends.First().LegendItemOrder = LegendItemOrder.SameAsSeriesOrder; } } Axis axisX = ChartAreas["Main"].AxisX; //To show lowest age interval axisX.IntervalOffset = 1; if (AdjustAxes) { adjustAxis(axisX); } //axisX.SetIntervalForLabelsByPixels(pixelsForLabelX); Axis axisY = ChartAreas["Main"].AxisY; if (OverrideAxesSettings == null) { double max = Series.Max(x => x.Points.Max(p => Math.Abs(p.YValues.Max()))); max = max.FindMax(); axisY.Minimum = max * -1; axisY.Maximum = max; axisY.SetIntervalForValuesByPixels(pixelsForLabelY); } else { if (OverrideAxesSettings != null) { axisY = OverrideAxesSettings.ApplyTo(this, axisY); } } if (AdjustAxes) { adjustAxis(ChartAreas["Main"].AxisY); } axisY.Maximum = Math.Max(axisY.Minimum.AsAbs(), axisY.Maximum.AsAbs()); axisY.Minimum = axisY.Maximum * -1; axisY.CustomLabels.Clear(); for (double i = axisY.Maximum * -1; i <= axisY.Maximum; i += axisY.Interval) { axisY.CustomLabels.Add( new CustomLabel() { LabelMark = LabelMarkStyle.SideMark, Text = Math.Abs(i).ToString(axisY.LabelStyle.Format), FromPosition = i - axisY.Interval / 2, ToPosition = i + axisY.Interval / 2 } ); } }