Exemple #1
0
        private void showInfoBtn_Click(object sender, EventArgs e)
        {
            DataGridViewRow selectedDataGridRow = showInfoBtn.Tag as DataGridViewRow;

            ExcelQuestion selectedQuestion = selectedDataGridRow.Cells["question"].Value as ExcelQuestion;
            ExcelProfile  selectedProfile  = mainTab.SelectedTab.Tag as ExcelProfile;


            Dictionary <ExcelQuestion, Tuple <Dictionary <string, int>, int, int> > questionInfoMap = new Dictionary <ExcelQuestion, Tuple <Dictionary <string, int>, int, int> >();

            questionInfoMap.Add(selectedQuestion, ProccesingDataService.GetQuestionInfo(selectedQuestion, selectedProfile, Document));

            using (QuestionInfoForm qif = new QuestionInfoForm())
            {
                qif.QuestionInfoMap = questionInfoMap;
                qif.ShowDialog();
            }
        }
        private void VisualisationForm_Load(object sender, EventArgs e)
        {
            bool first = true;

            foreach (var questionItem in Questions)
            {
                if (first)
                {
                    var questionInfo = ProccesingDataService.GetQuestionInfo(questionItem, Profile, Document);
                    points    = questionInfo.Item1;
                    responded = questionInfo.Item2;

                    visualChart = ProccesingDataService.CreateDefaultChart(visualChart, questionInfo, questionItem, DiagramType);
                    allTitle    = visualChart.Titles["allTitle"];
                    legend      = visualChart.Legends["mainLegend"];
                    mainTitle   = visualChart.Titles["mainTitle"];

                    first = false;
                }
                else
                {
                    var questionInfo = ProccesingDataService.GetQuestionInfo(questionItem, Profile, Document);
                    points    = questionInfo.Item1;
                    responded = questionInfo.Item2;

                    visualChart = ProccesingDataService.CreateDefaultChart(visualChart, questionInfo, questionItem, DiagramType, true);
                }
            }
            visualChart = ProccesingDataService.SettingDefaultChart(visualChart, visualChart.Series.ToList());

            if (Questions.Count != 1)
            {
                legendItems = legend.CustomItems.ToList();
                legend.CustomItems.Clear();
                foreach (var seriesItem in visualChart.Series)
                {
                    seriesItem.IsVisibleInLegend = true;
                }
            }

            showGridBtn.Checked = (visualChart.ChartAreas[0].AxisX.MajorGrid.Enabled && visualChart.ChartAreas[0].AxisY.MajorGrid.Enabled);
            if (visualChart.ChartAreas[0].AxisX.Enabled == AxisEnabled.False)
            {
                showAxisXBtn.Checked = false;
            }
            else
            {
                showAxisXBtn.Checked = true;
            }
            if (visualChart.ChartAreas[0].AxisY.Enabled == AxisEnabled.False)
            {
                showAxisYBtn.Checked = false;
            }
            else
            {
                showAxisYBtn.Checked = true;
            }
            mode3DSettingBtn.Checked = visualChart.ChartAreas[0].Area3DStyle.Enable3D;
            showLegendBtn.Checked    = visualChart.Legends.Select(x => x.Name).Contains("mainLegend");
            allItemBtn.Checked       = visualChart.Titles.Select(x => x.Name).Contains("allTitle");
            showTitleMBtn.Checked    = visualChart.Titles.Select(x => x.Name).Contains("mainTitle");
            if (visualChart.Series[0].Label == "#PERCENT")
            {
                percentMarkerBtn.Checked = true;
            }
            else if (visualChart.Series[0].Label == "#VAL")
            {
                valuesMarkerBtn.Checked = true;
            }
            else
            {
                noneMarkerBtn.Checked = true;
            }
            legendColValBtn.Checked = true;

            if (points.ContainsKey("другое"))
            {
                showOpenAnswersBtn.Visible = true;
            }

            visualChart.MouseClick += VisualChart_MouseClick;
        }