Exemplo n.º 1
0
        private void loadData()
        {
            try
            {
                if (Screen.AllScreens[MainWindow.locations[2]].Primary == true)
                {
                    if (MainWindow.locations[2] == 5)
                        MainWindow.locations[2] = 6;
                    else
                        MainWindow.locations[2] = 5;
                }
                this.Location = Screen.AllScreens[MainWindow.locations[2]].WorkingArea.Location;
                this.Size = Screen.AllScreens[MainWindow.locations[2]].WorkingArea.Size;
            }
            catch { }
            try
            {
                visifire vschart = new visifire();
                string str = System.AppDomain.CurrentDomain.BaseDirectory;
                Uri url = new Uri(str + "chart/Demo.htm");
                webBrowser.Url = url;

                chartdata.updateData(3, DateTime.Now, 0);

                vschart.reSize(webBrowser.Size.Width, webBrowser.Size.Height);
                vschart.settitle(DateTime.Now.ToString("yyyy年MM月") + "报表", "日期", "运输量(单位:吨)");
                string[] column = new string[31];
                double[] data = new double[31];
                double[] data2 = new double[31];
                int daysofm = Datetimecalc.daysofmonth(DateTime.Now);
                for (int i = 0; i < daysofm; i++)
                {
                    column[i] = (i + 1).ToString();
                    data[i] = chartdata.month[i];
                }
                vschart.s1 = DateTime.Now.ToString("yyyy年MM月");
                vschart.set3D(true);

                vschart.setData(column, data, daysofm);
                string type = "column";

                vschart.setType(type);
                webBrowser.Url = vschart.displayChart();

                //记录当前年月,用于判断是否更新
                curMonth = DateTime.Now.Month;
            }
            catch { }
        }
Exemplo n.º 2
0
        private void loadData()
        {
            try
            {
                Point p = Screen.AllScreens[MainWindow.locations[1]].WorkingArea.Location;
                this.Location = p;

                this.Size = Screen.AllScreens[MainWindow.locations[1]].WorkingArea.Size;
            }
            catch
            { }
            try
            {
                visifire vschart = new visifire();
                string str = System.AppDomain.CurrentDomain.BaseDirectory;
                Uri url = new Uri(str + "chart/Demo.htm");
                webBrowser.Url = url;

                chartdata.updateData(1, DateTime.Now, 0);
                chartdata.updateData(2, DateTime.Now, 0);
                vschart.reSize(webBrowser.Size.Width, webBrowser.Size.Height);
                vschart.settitle(DateTime.Now.AddYears(-1).ToString("yyyy") + "," + DateTime.Now.ToString("yyyy") + "年同比报表", "日期", "运输量(单位:吨)");
                string[] column = new string[12];
                double[] data = new double[12];
                double[] data2 = new double[12];
                for (int i = 0; i <= 11; i++)
                {
                    column[i] = (i + 1).ToString() + "月";
                    data[i] = chartdata.year[i];
                    data2[i] = chartdata.lastyear[i];
                }
                vschart.s1 = DateTime.Now.ToString("yyyy") + "年";
                vschart.s2 = DateTime.Now.AddMonths(-12).ToString("yyyy") + "年";
                vschart.set3D(true);

                vschart.setData(column, data, 12);
                vschart.setData2(data2);
                string type = "column";

                vschart.setType(type);
                webBrowser.Url = vschart.displayChart();
                curYear = DateTime.Now.Year;
            }
            catch { }
        }