예제 #1
0
        protected override DataTable CreateDataTable(string variableName)
        {
            var aggregation = (DataTableVisualProperties.DataTableHistogramAggregation)aggregationComboBox.SelectedItem;
            var hist        = HistogramContent.CreateHistogram(Content.PreprocessingData, variableName, Content.GroupingVariableName, aggregation, Content.Order);

            hist.VisualProperties.TitleFont = new Font(DefaultFont.FontFamily, 10, FontStyle.Bold);
            return(hist);
        }
        private Control GetBody(string colVariable, string rowVariable)
        {
            var key = Tuple.Create(colVariable, rowVariable);

            if (!bodyCache.ContainsKey(key))
            {
                if (rowVariable == colVariable) // use historgram if x and y variable are equal
                {
                    var dataTable = HistogramContent.CreateHistogram(
                        Content.PreprocessingData,
                        rowVariable,
                        (string)groupingComboBox.SelectedItem,
                        (AggregationType)aggregationComboBox.SelectedItem,
                        (PreprocessingChartContent.LegendOrder)legendOrderComboBox.SelectedItem);
                    dataTable.VisualProperties.Title = string.Empty;
                    foreach (var dataRow in dataTable.Rows)
                    {
                        dataRow.VisualProperties.IsVisibleInLegend = legendCheckbox.Checked && groupingComboBox.SelectedIndex > 0;
                    }
                    var pcv = new DataTableView {
                        Name          = key.ToString(),
                        Content       = dataTable,
                        Dock          = DockStyle.Fill,
                        ShowChartOnly = true
                    };
                    //pcv.ChartDoubleClick += HistogramDoubleClick;  // ToDo: not working; double click is already handled by the chart
                    bodyCache.Add(key, pcv);
                }
                else //scatter plot
                {
                    var scatterPlot = ScatterPlotContent.CreateScatterPlot(Content.PreprocessingData,
                                                                           colVariable,
                                                                           rowVariable,
                                                                           (string)groupingComboBox.SelectedItem,
                                                                           (PreprocessingChartContent.LegendOrder)legendOrderComboBox.SelectedItem);
                    var regressionType = (RegressionType)regressionTypeComboBox.SelectedValue;
                    int order          = (int)polynomialRegressionOrderNumericUpDown.Value;
                    int i      = 0;
                    var colors = PreprocessingChartView.Colors;
                    foreach (var row in scatterPlot.Rows)
                    {
                        row.VisualProperties.PointSize = (int)pointSizeNumericUpDown.Value;
                        row.VisualProperties.Color     = Color.FromArgb((int)(pointOpacityNumericUpDown.Value * 255),
                                                                        row.VisualProperties.Color.IsEmpty ? colors[i++ % colors.Length] : row.VisualProperties.Color);
                        row.VisualProperties.IsVisibleInLegend           = legendCheckbox.Checked && groupingComboBox.SelectedIndex > 0;
                        row.VisualProperties.IsRegressionVisibleInLegend = false;
                        row.VisualProperties.RegressionType            = regressionType;
                        row.VisualProperties.PolynomialRegressionOrder = order;
                    }
                    scatterPlot.VisualProperties.Title = string.Empty;
                    var scatterPlotView = new ScatterPlotView {
                        Name     = key.ToString(),
                        Content  = scatterPlot,
                        Dock     = DockStyle.Fill,
                        ShowName = false
                                   //ShowLegend = false,
                                   //XAxisFormat = "G3"
                    };
                    //scatterPlotView.DoubleClick += ScatterPlotDoubleClick; // ToDo: not working; double click is already handled by the chart
                    bodyCache.Add(key, scatterPlotView);
                }
            }
            return(bodyCache[key]);
        }