Beispiel #1
0
        private void allBarDiagramBtn_Click(object sender, EventArgs e)//+
        {
            if (Document != null)
            {
                try
                {
                    string dirPath    = CommonService.GetFolderPath();
                    string newDirPath = string.Empty;
                    if (dirPath != null)
                    {
                        newDirPath = ProccesingDataService.GroupDiagramSave(Document, dirPath, SeriesChartType.Bar);

                        Dictionary <string, ExcelProfile> excelProfileMap = new Dictionary <string, ExcelProfile>();
                        foreach (var excelProfileItem in Document.ProfilesListContent)
                        {
                            excelProfileMap.Add(excelProfileItem.Name, excelProfileItem);
                        }
                        DataManipulationService.SaveExcel("Опросы", "Ответы", excelProfileMap, Document, newDirPath + "\\" + Document.DocumentName + ".xlsx");
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
            else
            {
                MessageBox.Show("Сначала необходимо загрузить анкету.");
            }
        }
        private void showOpenAnswersBtn_Click(object sender, EventArgs e)
        {
            Dictionary <ExcelQuestion, Tuple <Dictionary <string, int>, int, int> > questionInfoMap = new Dictionary <ExcelQuestion, Tuple <Dictionary <string, int>, int, int> >();

            foreach (var questionItem in Questions)
            {
                questionInfoMap.Add(questionItem, ProccesingDataService.GetOpenInfo(questionItem, Profile, Document));
            }

            using (QuestionInfoForm qif = new QuestionInfoForm())
            {
                qif.QuestionInfoMap = questionInfoMap;
                qif.ShowDialog();
            }
        }
Beispiel #3
0
        private void openAnswerInfoBtn_Click(object sender, EventArgs e)
        {
            DataGridViewRow selectedDataGridRow = saveQuestionInfoBtn.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.GetOpenInfo(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;
        }