Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
        //open histogram in new tab with new content when double clicked
        private void HistogramDoubleClick(object sender, EventArgs e)
        {
            PreprocessingDataTableView pcv          = (PreprocessingDataTableView)sender;
            HistogramContent           histoContent = new HistogramContent(Content.PreprocessingData); // create new content

            histoContent.VariableItemList = Content.CreateVariableItemList();
            PreprocessingDataTable dataTable = pcv.Content;

            setVariableItemListFromDataTable(histoContent, dataTable);

            MainFormManager.MainForm.ShowContent(histoContent, typeof(HistogramView)); // open in new tab
        }
        //open histogram in new tab with new content when double clicked
        private void HistogramDoubleClick(object sender, EventArgs e)
        {
            DataTableView    pcv          = (DataTableView)sender;
            HistogramContent histoContent = new HistogramContent(Content.PreprocessingData); // create new content
                                                                                             //ToDo: histoContent.VariableItemList = Content.CreateVariableItemList();
            var dataTable = pcv.Content;

            //Set variable item list from with variable from data table
            if (dataTable.Rows.Count == 1) // only one data row should be in data table
            {
                string variableName = dataTable.Rows.ElementAt(0).Name;

                // set only variable name checked
                foreach (var checkedItem in histoContent.VariableItemList)
                {
                    histoContent.VariableItemList.SetItemCheckedState(checkedItem, checkedItem.Value == variableName);
                }
            }
            MainFormManager.MainForm.ShowContent(histoContent, typeof(HistogramView)); // open in new tab
        }
Ejemplo n.º 4
0
        //Set variable item list from with variable from data table
        private void setVariableItemListFromDataTable(HistogramContent histoContent, PreprocessingDataTable dataTable)
        {
            // only one data row should be in data table
            if (dataTable.Rows.Count == 1)
            {
                string variableName = dataTable.Rows.ElementAt(0).Name;

                // set only variable name checked
                foreach (var checkedItem in histoContent.VariableItemList)
                {
                    if (checkedItem.Value == variableName)
                    {
                        histoContent.VariableItemList.SetItemCheckedState(checkedItem, true);
                    }
                    else
                    {
                        histoContent.VariableItemList.SetItemCheckedState(checkedItem, false);
                    }
                }
            }
        }
    //open histogram in new tab with new content when double clicked
    private void HistogramDoubleClick(object sender, EventArgs e) {
      PreprocessingDataTableView pcv = (PreprocessingDataTableView)sender;
      HistogramContent histoContent = new HistogramContent(Content.PreprocessingData);  // create new content     
      histoContent.VariableItemList = Content.CreateVariableItemList();
      PreprocessingDataTable dataTable = pcv.Content;
      setVariableItemListFromDataTable(histoContent, dataTable);

      MainFormManager.MainForm.ShowContent(histoContent, typeof(HistogramView));  // open in new tab
    }
    //Set variable item list from with variable from data table
    private void setVariableItemListFromDataTable(HistogramContent histoContent, PreprocessingDataTable dataTable) {

      // only one data row should be in data table 
      if (dataTable.Rows.Count == 1) {
        string variableName = dataTable.Rows.ElementAt(0).Name;

        // set only variable name checked
        foreach (var checkedItem in histoContent.VariableItemList) {
          if (checkedItem.Value == variableName)
            histoContent.VariableItemList.SetItemCheckedState(checkedItem, true);
          else
            histoContent.VariableItemList.SetItemCheckedState(checkedItem, false);

        }
      }
    }
        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]);
        }