Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
120
Composite ProbabilityChart
posted

I am working on composite probability chart and for some reason the y-axis is Gaussian scale is lost when rendered. I am doing composite so I can control the label icons, legend and color used. below is the code.

 

            DeploymentScenario.FilePath = "ChartImages";

            UpperControlLimit = upperControlLimit;

            CenterLine = centerLine;

            //SetDefaultProperties();

            SetChartSize(chartSize);

            Tooltips.Display = TooltipDisplay.Never;

            /// Chart Type 

            ChartType = ChartType.Composite;

            Legend.Visible = true;

            Legend.Location = LegendLocation.Left;

            /// Define Chart Area

            var chartArea = GetChartArea();

            chartArea.Bounds = new Rectangle(0, 5, 100, 100);

            CompositeChart.ChartAreas.Add(chartArea);

            /// Define common yAxis

            var yAxis = new AxisItem();

            yAxis.LineThickness = 1;

            yAxis.Margin.Far = new AxisMargin { Value = 2 };

            yAxis.Margin.Near = new AxisMargin { Value = 2 };

            yAxis.Labels.Font = new Font("Arial", 7);

            yAxis.Labels.FontColor = Color.DimGray;

            yAxis.Labels.Visible = true;

            yAxis.MinorGridLines.Visible = true;

            yAxis.Extent = 40;         

            yAxis.Labels.ItemFormatString = "<DATA_VALUE:0.00>";

            /// y-axes

            yAxis.TickmarkStyle = AxisTickStyle.Smart;

            yAxis.axisNumber = AxisNumber.Y_Axis;

            yAxis.DataType = AxisDataType.Numeric;

            yAxis.SetLabelAxisType = SetLabelAxisType.GroupBySeries;

            chartArea.Axes.Add(yAxis);

            /// Define common xAxis

            var xAxis = new AxisItem();

            xAxis.Labels.FontColor = Color.DimGray;

            xAxis.Labels.Font = new Font("arial", 7);

            xAxis.Labels.Visible = true;

            xAxis.LineThickness = 1;

            xAxis.Margin.Far = new AxisMargin { Value = 2 };

            xAxis.Margin.Near = new AxisMargin { Value = 2 };

            xAxis.DataType = AxisDataType.Numeric;

            xAxis.SetLabelAxisType = SetLabelAxisType.ContinuousData;

            xAxis.Labels.ItemFormat = AxisItemLabelFormat.DataValue;

            xAxis.Labels.ItemFormatString = "<DATA_VALUE:0.00>";

            xAxis.Extent = 100;

            chartArea.Axes.Add(xAxis);

            var seriesNames = (cumProbPlotDataList.OrderBy(record => record.Name).Select(record => record.Name)).Distinct();

            var seriesIndex = 0;

            foreach (var seriesName in seriesNames)

            {

                var paintElement = new PaintElement(CustomColorMultiseries[seriesIndex]) { FillOpacity = 150 };

                var cumProbPlotDataSeries = cumProbPlotDataList.Where(record => record.Name == seriesName);

                XYSeries xySeries = new XYSeries();

                xySeries.PEs.Add(paintElement);

                xySeries.Label = seriesName; /// if you forget this, label will not show up, ouch

                foreach (var cumProbPlotData in cumProbPlotDataSeries)

                {

                    var xyDataPoint = new XYDataPoint(cumProbPlotData.DataPoint, (Double)cumProbPlotData.Percentile, seriesName, false);

                    xySeries.Points.Add(xyDataPoint);

                }

                var chartLayerAppearance = new ChartLayerAppearance();

                chartLayerAppearance.ChartType = ChartType.ProbabilityChart;

                chartLayerAppearance.ChartArea = chartArea;

                chartLayerAppearance.AxisX = xAxis;

                chartLayerAppearance.AxisY = yAxis;

                chartLayerAppearance.Series.Add(xySeries);

                var probabilityChartAppearance = new ProbabilityChartAppearance();

                probabilityChartAppearance.Icon = CustomSymbolIconMultiseries[seriesIndex];

                probabilityChartAppearance.IconSize = SymbolIconSize.Medium; 

                probabilityChartAppearance.LineAppearance.Thickness = 1;

                probabilityChartAppearance.LineAppearance.DrawStyle = LineDrawStyle.Dash;

                probabilityChartAppearance.ConnectWithLines = true;

                chartLayerAppearance.ChartTypeAppearances.Add(probabilityChartAppearance);

                CompositeChart.ChartLayers.Add(chartLayerAppearance);

                /// index the series

                seriesIndex++;

            }

            /// Add composite legend

            var compositeLegend = GetCompositeLegend();

            CompositeChart.Legends.Add(compositeLegend);

            /// update the legend icon so they march the line icon

            FillSceneGraph += UpdateLabelIconFillSceneGraph;

            FillSceneGraph += CumProbPlotFillSceneGraph;

Regards and Thanks,

James