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

 

Parents
  • 26458
    Offline posted

    This appears to be a bug in the composite chart. You can still use a non-composite chart as a workaround. You can create XYSeries and add them to chart.Series collection. The icon and line colors can be set from each of the series by using series.PEs property. Use chart.ProbabilityChart.ConnectWithLines = tue to display connected points.

    The trickier part is to get the icons you want to show up. You will have to use FillSceneGraph and set icon and iconsize on each PointSet primitive. Here's an example:

    private void ultraChart1_FillSceneGraph(object sender, Infragistics.UltraChart.Shared.Events.FillSceneGraphEventArgs e)
    {
        List<PointSet> pointSets = new List<PointSet>();
        foreach (var item in e.SceneGraph)
        {
            PointSet pointSet = item as PointSet;
            if (pointSet != null)
            {
                pointSets.Add(pointSet);
            }
        }

        SymbolIcon[] icons = { SymbolIcon.Square, SymbolIcon.Circle, SymbolIcon.Diamond };
        int counter = 0;

        foreach (var item in pointSets)
        {
            item.icon = icons[counter % 3];
            item.iconSize = SymbolIconSize.Large;
            counter++;
        }
    }

    In the meantime you can submit a but report to our developer support group, so they can register a bug for you. You can do this here: http://infragistics.com/gethelp

     

Reply Children
No Data