Exemple #1
0
 private bool GetListUniCharts(string flag, string ttl)  // 生成图表输出数据集
 {
     try
     {
         charts.Clear();
         DataRow[] rows = cfgDS.Tables["TEST"].Select("Flag = '" + flag + "'");
         foreach (DataRow row in rows)
         {
             if (flag == "表单")
             {
                 if (row["Title"].ToString().Trim().Substring(0, row["Title"].ToString().Trim().IndexOf("-")) != ttl)
                 {
                     continue;
                 }
             }
             else
             if (row["Title"].ToString().Trim().Substring(0, 4) != ttl)
             {
                 continue;                                                           //将图标题截取为例如“图A-1”形式,与字符串ttl进行比较
             }
             chart       = new UniChart();
             chart.title = row["Title"].ToString().Trim();
             string file = outPath + chart.title.Substring(0, row["Title"].ToString().Trim().IndexOf(" ")).Trim() + ".xml";
             if (!File.Exists(file))
             {
                 continue;
             }
             chart.chart = new DataSet();
             chart.chart.ReadXml(file);
             chart.remark = row["Remark"].ToString().Trim();
             chart.unit   = row["Unit"].ToString().Trim();
             chart.page   = Convert.ToInt32(row["Page"]);
             charts.Add(chart);
         }
         return(true);
     }
     catch (Exception ex)
     {
         HUSTLog.WriteLog(ex);
         return(false);
     }
 }
Exemple #2
0
        private void createPlot()
        {
            Size size = new Size(740, 400);

            //CREATE PLOT
            PanelPlot      = UniPanel.Create(Dialog, BorderStyle.None, false);
            PanelPlot.Size = new Size(size.Width, size.Height + 30);

            //CHART
            UniChart chart = UniChart.Create(PanelPlot, 0, 0, size.Width, size.Height, BorderStyle.FixedSingle);

            chart.setTitles(null, null, "Performance in %");
            chart.setLabelFormat(null, "0%");
            chart.setStartFromZeros(false);

            //EVENT LISTENER
            PanelPlot.VisibleChanged += (s, e) =>
            {
                //GET PERFORMANCE
                double[] perArray = new double[PerformanceList.Count];
                for (int i = 0; i < perArray.Length; i++)
                {
                    perArray[i] = PerformanceList[i].Performance;
                }

                //PREPARE CHART
                chart.SeriesRemove();
                Series series = chart.SeriesLine("Performance of Network", SeriesChartType.Line, Colors.MainRecessive, 1, perArray, null);
                series.MarkerStyle       = MarkerStyle.Circle;
                series.MarkerColor       = Colors.MainDominant;
                series.MarkerSize        = 4;
                series.MarkerBorderWidth = 1;
                series.MarkerBorderColor = Colors.MainRecessive;

                //DATA LABEL
                for (int i = 0; i < PerformanceList.Count; i++)
                {
                    series.Points[i].Label = "LR: " + (PerformanceList[i].LearningRate * 100) + "%\nE: " + PerformanceList[i].Epochs + "\n(" + PerformanceList[i].Duration.ToString(@"mm\:ss") + ")";
                }
            };
        }