Пример #1
0
        public static ChartProperties getChartProperties(int max, bool steppedPBR)
        {
            ChartProperties props=new ChartProperties();
            props.XAxisType = XAxisTypeEnum.datetime;
            props.XValueFormatString = "dd.MM HH:mm";

            ChartAxisProperties pAx=new ChartAxisProperties();
            pAx.ProcessAuto = true;
            pAx.Auto = true;
            pAx.Min = 0;
            pAx.Max = max;
            pAx.Interval = 10;
            pAx.MinHeight = 10;
            pAx.Index = 0;

            ChartAxisProperties vAx=new ChartAxisProperties();
            vAx.Auto = true;
            vAx.Index = 1;

            props.addAxis(pAx);
            props.addAxis(vAx);

            ChartSerieProperties FaktSerie=new ChartSerieProperties();
            FaktSerie.Color = "0-0-255";
            FaktSerie.Title = "Факт";
            FaktSerie.TagName = "Fakt";
            FaktSerie.LineWidth = 2;
            FaktSerie.SerieType = ChartSerieType.stepLine;
            FaktSerie.YAxisIndex = 0;
            FaktSerie.Enabled = true;

            ChartSerieProperties PlanSerie=new ChartSerieProperties();
            PlanSerie.Color = "0-255-0";
            PlanSerie.Title = "План";
            PlanSerie.TagName = "Plan";
            PlanSerie.LineWidth = 1;
            PlanSerie.SerieType = steppedPBR ? ChartSerieType.stepLine : ChartSerieType.line;
            PlanSerie.YAxisIndex = 0;
            PlanSerie.Enabled = true;

            props.addSerie(FaktSerie);
            props.addSerie(PlanSerie);

            return props;
        }
Пример #2
0
        public static ChartProperties getChartProperties(bool steppedPBR)
        {
            ChartProperties props=new ChartProperties();
            props.XAxisType = XAxisTypeEnum.datetime;
            props.XValueFormatString = "dd.MM HH:mm";

            ChartAxisProperties pAx=new ChartAxisProperties();
            pAx.Auto = true;
            pAx.Min = 0;
            pAx.Max = 1050;
            pAx.Interval = 50;
            pAx.Index = 0;

            ChartAxisProperties vAx=new ChartAxisProperties();
            vAx.Auto = true;
            vAx.Index = 1;

            props.addAxis(pAx);
            props.addAxis(vAx);

            ChartSerieProperties gtp1FaktSerie=new ChartSerieProperties();
            gtp1FaktSerie.Color = "0-255-0";
            gtp1FaktSerie.Title = "ГТП-1 факт";
            gtp1FaktSerie.TagName = "gtp1Fakt";
            gtp1FaktSerie.LineWidth = 2;
            gtp1FaktSerie.SerieType = ChartSerieType.stepLine;
            gtp1FaktSerie.YAxisIndex = 0;
            gtp1FaktSerie.Enabled = true;

            ChartSerieProperties gtp2FaktSerie=new ChartSerieProperties();
            gtp2FaktSerie.Color = "0-0-255";
            gtp2FaktSerie.Title = "ГТП-2 факт";
            gtp2FaktSerie.TagName = "gtp2Fakt";
            gtp2FaktSerie.LineWidth = 2;
            gtp2FaktSerie.SerieType = ChartSerieType.stepLine;
            gtp2FaktSerie.YAxisIndex = 0;
            gtp2FaktSerie.Enabled = true;

            ChartSerieProperties gesFaktSerie=new ChartSerieProperties();
            gesFaktSerie.Color = "0-0-0";
            gesFaktSerie.Title = "ГЭС факт";
            gesFaktSerie.TagName = "gesFakt";
            gesFaktSerie.LineWidth = 2;
            gesFaktSerie.SerieType = ChartSerieType.stepLine;
            gesFaktSerie.YAxisIndex = 0;
            gesFaktSerie.Enabled = false;

            ChartSerieProperties gtp1PlanSerie=new ChartSerieProperties();
            gtp1PlanSerie.Color = "0-255-0";
            gtp1PlanSerie.Title = "ГТП-1 план";
            gtp1PlanSerie.TagName = "gtp1Plan";
            gtp1PlanSerie.LineWidth = 1;
            gtp1PlanSerie.SerieType = steppedPBR?ChartSerieType.stepLine:ChartSerieType.line;
            gtp1PlanSerie.YAxisIndex = 0;
            gtp1PlanSerie.Enabled = true;

            ChartSerieProperties gtp2PlanSerie=new ChartSerieProperties();
            gtp2PlanSerie.Color = "0-0-255";
            gtp2PlanSerie.Title = "ГТП-2 план";
            gtp2PlanSerie.TagName = "gtp2Plan";
            gtp2PlanSerie.LineWidth = 1;
            gtp2PlanSerie.SerieType = steppedPBR ? ChartSerieType.stepLine : ChartSerieType.line;
            gtp2PlanSerie.YAxisIndex = 0;
            gtp2PlanSerie.Enabled = true;

            ChartSerieProperties gesPlanSerie=new ChartSerieProperties();
            gesPlanSerie.Color = "0-0-0";
            gesPlanSerie.Title = "ГЭС план";
            gesPlanSerie.TagName = "gesPlan";
            gesPlanSerie.LineWidth = 1;
            gesPlanSerie.SerieType = steppedPBR ? ChartSerieType.stepLine : ChartSerieType.line;
            gesPlanSerie.YAxisIndex = 0;
            gesPlanSerie.Enabled = false;

            ChartSerieProperties vyrabFaktSerie=new ChartSerieProperties();
            vyrabFaktSerie.Color = "255-0-0";
            vyrabFaktSerie.Title = "Выработка факт";
            vyrabFaktSerie.TagName = "vyrabFakt";
            vyrabFaktSerie.LineWidth = 2;
            vyrabFaktSerie.SerieType = ChartSerieType.stepLine;
            vyrabFaktSerie.YAxisIndex = 1;
            vyrabFaktSerie.Enabled = true;

            ChartSerieProperties vyrabPlanSerie=new ChartSerieProperties();
            vyrabPlanSerie.Color = "255-0-0";
            vyrabPlanSerie.Title = "Выработка план";
            vyrabPlanSerie.TagName = "vyrabPlan";
            vyrabPlanSerie.LineWidth = 1;
            vyrabPlanSerie.SerieType = ChartSerieType.stepLine;
            vyrabPlanSerie.YAxisIndex = 1;
            vyrabPlanSerie.Enabled = true;

            props.addSerie(gtp1FaktSerie);
            props.addSerie(gtp2FaktSerie);
            props.addSerie(gesFaktSerie);
            props.addSerie(gtp1PlanSerie);
            props.addSerie(gtp2PlanSerie);
            props.addSerie(gesPlanSerie);
            props.addSerie(vyrabPlanSerie);
            props.addSerie(vyrabFaktSerie);

            return props;
        }
Пример #3
0
        public ChartProperties createChartProperties()
        {
            ChartProperties props=new ChartProperties();
            props.XAxisType = XAxisTypeEnum.datetime;

            ChartAxisProperties pAx=new ChartAxisProperties();
            pAx.Min = 0;
            pAx.Max = 1020;
            pAx.Auto = false;
            pAx.Interval = 100;
            pAx.Index = 1;

            ChartAxisProperties nbAx=new ChartAxisProperties();
            nbAx.Auto = true;
            nbAx.Interval = 0.1;
            nbAx.Index = 0;

            ChartAxisProperties qAx=new ChartAxisProperties();
            qAx.Auto = false;
            qAx.Min = 0;
            qAx.Max = 7200;
            qAx.Index = 2;

            ChartAxisProperties vbAx=new ChartAxisProperties();
            vbAx.Auto = true;
            vbAx.Index = 3;

            ChartAxisProperties naporAx=new ChartAxisProperties();
            naporAx.Auto = true;
            naporAx.Index = 4;

            ChartAxisProperties tAx=new ChartAxisProperties();
            tAx.Auto = false;
            tAx.Min = -40;
            tAx.Max = 40;
            tAx.Index = 5;

            ChartSerieProperties pSerie=new ChartSerieProperties();
            pSerie.Color = "0-0-255";
            pSerie.LineWidth = 2;
            pSerie.SerieType = ChartSerieType.line;
            pSerie.Title = "P факт";
            pSerie.TagName = "PFakt";
            pSerie.YAxisIndex = 1;

            ChartSerieProperties pbrSerie=new ChartSerieProperties();
            pbrSerie.Color = "0-0-255";
            pbrSerie.LineWidth = 1;
            pbrSerie.SerieType = ChartSerieType.line;
            pbrSerie.Title = "ПБР";
            pbrSerie.TagName = "PBR";
            pbrSerie.YAxisIndex = 1;

            ChartSerieProperties nbFaktSerie=new ChartSerieProperties();
            nbFaktSerie.Color = "255-0-0";
            nbFaktSerie.LineWidth = 2;
            nbFaktSerie.SerieType = ChartSerieType.line;
            nbFaktSerie.Title = "НБ факт";
            nbFaktSerie.TagName = "NBFakt";
            nbFaktSerie.YAxisIndex = 0;

            ChartSerieProperties nbPrognozSerie=new ChartSerieProperties();
            nbPrognozSerie.Color = "255-0-0";
            nbPrognozSerie.LineWidth = 1;
            nbPrognozSerie.SerieType = ChartSerieType.line;
            nbPrognozSerie.Title = "НБ прогноз";
            nbPrognozSerie.TagName = "NBPrognoz";
            nbPrognozSerie.YAxisIndex = 0;

            ChartSerieProperties qFaktSerie=new ChartSerieProperties();
            qFaktSerie.Color = "0-255-0";
            qFaktSerie.LineWidth = 2;
            qFaktSerie.SerieType = ChartSerieType.line;
            qFaktSerie.Title = "Q факт";
            qFaktSerie.TagName = "QFakt";
            qFaktSerie.YAxisIndex = 2;

            ChartSerieProperties qPrognozSerie=new ChartSerieProperties();
            qPrognozSerie.Color = "0-255-0";
            qPrognozSerie.LineWidth = 1;
            qPrognozSerie.SerieType = ChartSerieType.line;
            qPrognozSerie.Title = "Q прогноз";
            qPrognozSerie.TagName = "QPrognoz";
            qPrognozSerie.Enabled = false;
            qPrognozSerie.YAxisIndex = 2;

            ChartSerieProperties vbSerie=new ChartSerieProperties();
            vbSerie.Color = "0-255-255";
            vbSerie.LineWidth = 2;
            vbSerie.SerieType = ChartSerieType.line;
            vbSerie.Title = "ВБ";
            vbSerie.TagName = "VB";
            vbSerie.Enabled = false;
            vbSerie.YAxisIndex = 3;

            ChartSerieProperties naporSerie=new ChartSerieProperties();
            naporSerie.Color = "255-0-255";
            naporSerie.LineWidth = 2;
            naporSerie.SerieType = ChartSerieType.line;
            naporSerie.Title = "Напор";
            naporSerie.TagName = "Napor";
            naporSerie.Enabled = false;
            naporSerie.YAxisIndex = 4;

            ChartSerieProperties naporPrognozSerie=new ChartSerieProperties();
            naporPrognozSerie.Color = "255-0-255";
            naporPrognozSerie.LineWidth = 1;
            naporPrognozSerie.SerieType = ChartSerieType.line;
            naporPrognozSerie.Title = "Напор прогноз";
            naporPrognozSerie.TagName = "NaporPrognoz";
            naporPrognozSerie.Enabled = false;
            naporPrognozSerie.YAxisIndex = 4;

            ChartSerieProperties tSerie=new ChartSerieProperties();
            tSerie.Color = "120-0-255";
            tSerie.LineWidth = 2;
            tSerie.SerieType = ChartSerieType.line;
            tSerie.Title = "Температура";
            tSerie.TagName = "T";
            tSerie.Enabled = false;
            tSerie.YAxisIndex = 5;

            props.addAxis(pAx);
            props.addAxis(nbAx);
            props.addAxis(qAx);
            props.addAxis(vbAx);
            props.addAxis(naporAx);
            props.addAxis(tAx);

            props.addSerie(pSerie);
            props.addSerie(pbrSerie);
            props.addSerie(nbFaktSerie);
            props.addSerie(nbPrognozSerie);
            props.addSerie(qFaktSerie);
            props.addSerie(qPrognozSerie);
            props.addSerie(vbSerie);
            props.addSerie(naporSerie);
            props.addSerie(naporPrognozSerie);
            props.addSerie(tSerie);

            props.XAxisType = XAxisTypeEnum.datetime;

            return props;
        }
Пример #4
0
 public void addAxis(ChartAxisProperties ax)
 {
     if (!AxesNumbers.Keys.Contains(ax.Index)) {
         Axes.Add(ax);
         AxesNumbers.Add(ax.Index, Axes.IndexOf(ax));
     }
 }
Пример #5
0
        public static ChartProperties fromXML(string fileName)
        {
            try {
                XmlSerializer mySerializer = new XmlSerializer(typeof(ChartProperties));
                // To read the file, create a FileStream.
                FileStream myFileStream = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.Read); ;
                // Call the Deserialize method and cast to the object type.
                ChartProperties data = (ChartProperties)mySerializer.Deserialize(myFileStream);
                myFileStream.Close();

                if (data.Axes.Count == 0) {
                    data.Axes = new List<ChartAxisProperties>();

                    ChartAxisProperties main=new ChartAxisProperties();
                    main.Auto = true;
                    main.Index = 0;

                    ChartAxisProperties sec=new ChartAxisProperties();
                    sec.Auto = true;
                    sec.Index = 1;

                    data.Axes.Add(main);
                    data.Axes.Add(sec);
                }
                return data;
            } catch (Exception e) {
                Logger.Error(e.ToString());
                return null;
            }
        }
Пример #6
0
        public virtual void CreateChart()
        {
            Answer.Chart = new ChartAnswer();
            Answer.Chart.Properties = new ChartProperties();
            Answer.Chart.Data = new ChartData();

            ChartAxisProperties ax=new ChartAxisProperties();
            ax.Auto = true;
            ax.Index = 0;

            ChartAxisProperties ax1=new ChartAxisProperties();
            ax1.Auto = true;
            ax1.Index = 1;

            Answer.Chart.Properties.addAxis(ax);
            Answer.Chart.Properties.addAxis(ax1);

            ChartSerieType type=ChartSerieType.stepLine;
            if (Interval == IntervalReportEnum.quarter || Interval == IntervalReportEnum.month) {
                type = ChartSerieType.column;
            }

            Answer.Chart.Properties.XAxisType = XAxisTypeEnum.datetime;

            Answer.Chart.Properties.XValueFormatString = getDateFormat();

            Random r=new Random();
            int indexColor=0;
            foreach (RecordTypeBase recordType in RecordTypes.Values) {
                if (recordType.ToChart) {
                    ChartSerieProperties props=new ChartSerieProperties();
                    props.Title = recordType.Title;
                    props.TagName = recordType.ID;
                    props.LineWidth = 2;
                    props.Color = ChartColor.GetColorStr(indexColor++);
                    props.SerieType = type;
                    props.YAxisIndex = 0;
                    Answer.Chart.Properties.addSerie(props);

                    ChartDataSerie data=new ChartDataSerie();
                    data.Name = recordType.ID;
                    foreach (DateTime date in Dates) {
                        DateTime dt=GetCorrectedDateForChart(date);
                        data.Points.Add(new ChartDataPoint(dt, Data[date][recordType.ID]));
                    }
                    Answer.Chart.Data.addSerie(data);
                }
            }
        }
Пример #7
0
        public virtual void CreateChart(List<Report> reportAddList = null)
        {
            Answer.Chart = new ChartAnswer();
            Answer.Chart.Properties = new ChartProperties();
            Answer.Chart.Data = new ChartData();

            ChartAxisProperties ax=new ChartAxisProperties();
            ax.Auto = true;
            ax.Index = 0;

            ChartAxisProperties ax1=new ChartAxisProperties();
            ax1.Auto = true;
            ax1.Index = 1;

            Answer.Chart.Properties.addAxis(ax);
            Answer.Chart.Properties.addAxis(ax1);

            ChartSerieType type=ChartSerieType.stepLine;
            if (Interval == IntervalReportEnum.quarter || Interval == IntervalReportEnum.month || Interval == IntervalReportEnum.year) {
                type = ChartSerieType.column;
            }

            Answer.Chart.Properties.XAxisType = XAxisTypeEnum.datetime;

            Answer.Chart.Properties.XValueFormatString = getDateFormat(reportAddList != null);

            Random r=new Random();
            int indexColor=0;
            foreach (RecordTypeBase recordType in RecordTypes.Values) {
                if (recordType.ToChart) {
                    ChartSerieProperties props=new ChartSerieProperties();
                    string title=reportAddList != null ? recordType.Title + " " + AddReportTitle : recordType.Title;
                    props.Title = title;
                    props.TagName = recordType.ID;
                    props.LineWidth = 2;
                    props.Color = ChartColor.GetColorStr(indexColor++);
                    props.SerieType = type;
                    props.YAxisIndex = 0;
                    Answer.Chart.Properties.addSerie(props);

                    ChartDataSerie data=new ChartDataSerie();
                    data.Name = recordType.ID;
                    foreach (DateTime date in Dates) {
                        DateTime dt=GetCorrectedDateForChart(date);
                        data.Points.Add(new ChartDataPoint(dt, Data[date][recordType.ID]));
                    }
                    Answer.Chart.Data.addSerie(data);

                    if (reportAddList != null) {
                        foreach (Report reportAdd in reportAddList) {
                            int diffY = reportAdd.DateStart.Year - DateStart.Year;
                            int diffM = reportAdd.DateStart.Month - DateStart.Month;
                            int diffD = reportAdd.DateStart.Day - DateStart.Day;
                            props = new ChartSerieProperties();
                            props.Title = recordType.Title + " " + reportAdd.AddReportTitle;
                            props.TagName = recordType.ID + "_" + reportAdd.AddReportTitle;
                            props.LineWidth = 1;
                            props.Color = ChartColor.GetColorStr(indexColor++);
                            props.SerieType = type;
                            props.YAxisIndex = 0;
                            Answer.Chart.Properties.addSerie(props);

                            data = new ChartDataSerie();
                            data.Name = recordType.ID + "_" + reportAdd.AddReportTitle;
                            foreach (DateTime date in Dates) {
                                DateTime dt=GetCorrectedDateForChart(date);
                                try {
                                    DateTime newDate=date.AddYears(diffY).AddMonths(diffM).AddDays(diffD);
                                    data.Points.Add(new ChartDataPoint(dt, reportAdd.Data[newDate][recordType.ID]));
                                } catch { }
                            }
                            Answer.Chart.Data.addSerie(data);
                        }
                    }
                }
            }
        }