//固件明细数据
        protected List <SeriesJsonModel> GetDataJsonListByGjbb(List <DateTime> x_date, List <Sjqd_StatUsersByGjbb> gjbb)
        {
            List <SeriesJsonModel> result   = new List <SeriesJsonModel>();
            SeriesJsonModel        sjModel2 = new SeriesJsonModel();
            int spanInt = -(x_date.Count / 25 + 1);

            for (int ii = 0; ii < x_date.Count; ii++)
            {
                DataLabels dl = null;
                sjModel2.data.Add(dl);
            }
            sjModel2.name = "固件版本分布";
            for (int i = 0; i < gjbb.Count; i++)
            {
                for (int j = 0; j < x_date.Count; j++)
                {
                    if (x_date[j] == gjbb[i].StatDate)
                    {
                        DataLabels      dl        = new DataLabels();
                        SmallDataLabels smalldata = new SmallDataLabels();
                        dl.y          = gjbb[i].UseCount;
                        dl.dataLabels = smalldata;
                        if (j % spanInt == 0)//这个间隔和x轴设置是一样的
                        {
                            smalldata.enabled = true;
                        }
                        ///替换掉以前的null
                        sjModel2.data[j] = dl;
                    }
                }
            }
            result.Add(sjModel2);
            return(result);
        }
Example #2
0
        public static void Run()
        {
            // ExStart:RichTextCustomDataLabelOfChartPoint
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

            // Create a workbook from source Excel file
            Workbook workbook = new Workbook(dataDir + "sample.xlsx");

            // Access first worksheet
            Worksheet worksheet = workbook.Worksheets[0];

            // Access the first chart inside the sheet
            Chart chart = worksheet.Charts[0];

            // Access the data label of first series first point
            DataLabels dlbls = chart.NSeries[0].Points[0].DataLabels;

            // Set data label text
            dlbls.Text = "Rich Text Label";

            // Set the font setting of the first 10 characters
            FontSetting fntSetting = dlbls.Characters(0, 10);

            fntSetting.Font.Color  = Color.Red;
            fntSetting.Font.IsBold = true;

            // Save the workbook
            workbook.Save(dataDir + "output_out.xlsx");
            // ExEnd:RichTextCustomDataLabelOfChartPoint
        }
        public static void Run()
        {
            //Source directory
            string sourceDir = RunExamples.Get_SourceDirectory();

            //Output directory
            string outputDir = RunExamples.Get_OutputDirectory();

            // Create workbook from the source Excel file
            Workbook workbook = new Workbook(sourceDir + "sampleShowCellRangeAsDataLabels.xlsx");

            // Access the first worksheet
            Worksheet worksheet = workbook.Worksheets[0];

            // Access the chart inside the worksheet
            Chart chart = worksheet.Charts[0];

            // Check the "Label Contains - Value From Cells"
            DataLabels dataLabels = chart.NSeries[0].DataLabels;

            dataLabels.LinkedSource  = "=Sheet1!$B$2:$B$10";
            dataLabels.ShowCellRange = true;

            // Save the workbook
            workbook.Save(outputDir + "outputShowCellRangeAsDataLabels.xlsx");

            Console.WriteLine("ShowCellRangeAsDataLabels executed successfully.");
        }
        /// <summary>
        /// json转换函数
        /// </summary>
        /// <param name="softs"></param>
        /// <returns></returns>
        protected List <SeriesJsonModel> GetDataJsonList(List <Sjqd_StatLifecycle> softs)
        {
            ///构造一个json模型
            SeriesJsonModel sjModel2 = new SeriesJsonModel();

            sjModel2.data = new List <object>();
            for (int i = 0; i < softs.Count; i++)
            {
                string plat = softs[0].Platform.ToString().ToEnum <MobileOption>(MobileOption.None).ToString();
                if (plat == "None")
                {
                    plat = "不区分平台";
                }
                sjModel2.name = GetSoft(softs[0].SoftID).Name + "_" + plat + "(" + softs[0].StatDate.ToShortDateString() + ")";
                DataLabels      dl        = new DataLabels();
                SmallDataLabels smalldata = new SmallDataLabels();
                dl.y              = Math.Round((softs[i].RetainedUserCount / (double)softs[i].NewUserCount) * 100, 2);
                dl.growth         = dl.y + "%";
                dl.Denominator    = softs[i].NewUserCount;
                smalldata.enabled = true;
                dl.dataLabels     = smalldata;
                sjModel2.data.Add(dl);
            }
            seriesJsonStr.Add(sjModel2);
            return(seriesJsonStr);
        }
Example #5
0
        /// <summary>
        /// Called during loading of the form
        /// Adds the available labels to the Selection box.
        /// </summary>
        private void SetLocalDataLabels()
        {
            double             widthInCm;
            PDataLabelTable    DataLabels;
            PDataLabelUseTable DataLabelUse;

            DataRow[] filteredRows;

            DataLabels   = (PDataLabelTable)TDataCache.TMPartner.GetCacheablePartnerTable(TCacheablePartnerTablesEnum.DataLabelList);
            DataLabelUse = (PDataLabelUseTable)TDataCache.TMPartner.GetCacheablePartnerTable(TCacheablePartnerTablesEnum.DataLabelUseList);

            foreach (PDataLabelUseRow UseRow in DataLabelUse.Rows)
            {
                if ((UseRow.Use == "Bank") ||
                    (UseRow.Use == "Church") ||
                    (UseRow.Use == "Family") ||
                    (UseRow.Use == "Organisation") ||
                    (UseRow.Use == "Person") ||
                    (UseRow.Use == "Unit") ||
                    (UseRow.Use == "Venue"))
                {
                    filteredRows = DataLabels.Select(PDataLabelTable.GetKeyDBName() + " = " + UseRow.DataLabelKey.ToString());

                    if (filteredRows.Length > 0)
                    {
                        PDataLabelRow row = (PDataLabelRow)filteredRows[0];

                        if (row.DataType == "char")
                        {
                            widthInCm = TPartnerColumnFunction.CharLengthToCM(row.CharLength);
                        }
                        else if (row.DataType == "partnerkey")
                        {
                            widthInCm = TPartnerColumnFunction.CharLengthToCM(10);
                        }
                        else if (row.DataType == "lookup")
                        {
                            widthInCm = TPartnerColumnFunction.CharLengthToCM(14);
                        }
                        else if (row.DataType == "boolean")
                        {
                            widthInCm = TPartnerColumnFunction.CharLengthToCM(5);
                        }
                        else
                        {
                            widthInCm = TPartnerColumnFunction.CharLengthToCM(10);
                        }

                        /* minimum width of column, so that the caption can be displayed (with a footnote number if necessary) */
                        if (widthInCm < 1.5)
                        {
                            widthInCm = 1.5;
                        }

                        FPetraUtilsObject.AddAvailableFunction(new TPartnerColumnFunction("DataLabelColumn", "param_label", row.Text, widthInCm)); //FPetraUtilsObject.AddAvailableFunction(new TPartnerColumnFunction(row.Text, "param_label",
                                                                                                                                                   // "DataLabelColumn", widthInCm));
                    }
                }
            }
        }
Example #6
0
        public static void Run()
        {
            //Source directory
            string sourceDir = RunExamples.Get_SourceDirectory();

            //Output directory
            string outputDir = RunExamples.Get_OutputDirectory();

            // Create a workbook from source Excel file
            Workbook workbook = new Workbook(sourceDir + "sampleRichTextCustomDataLabel.xlsx");

            // Access first worksheet
            Worksheet worksheet = workbook.Worksheets[0];

            // Access the first chart inside the sheet
            Chart chart = worksheet.Charts[0];

            // Access the data label of first series first point
            DataLabels dlbls = chart.NSeries[0].Points[0].DataLabels;

            // Set data label text
            dlbls.Text = "Rich Text Label";

            // Set the font setting of the first 10 characters
            FontSetting fntSetting = dlbls.Characters(0, 10);

            fntSetting.Font.Color  = Color.Red;
            fntSetting.Font.IsBold = true;

            // Save the workbook
            workbook.Save(outputDir + "outputRichTextCustomDataLabel.xlsx");

            Console.WriteLine("RichTextCustomDataLabel executed successfully.");
        }
Example #7
0
        internal void SetImageGroupLabels(ImageGroup data, string imageId, DataLabels labels)
        {
            data.Labels[imageId] = labels;
            var path = Path.Combine(_rootDataPath, data.Id, "labels.json");
            var json = JsonConvert.SerializeObject(data.Labels);

            File.WriteAllText(path, json);
        }
 /// <summary>
 /// 获取y轴数据
 /// </summary>
 /// <param name="temp"></param>
 protected void GetDataJsonList(List <List <Monitor_DataLogs> > temp)
 {
     foreach (var item in temp)
     {
         ///构造一个json模型
         SeriesJsonModel sjModel2 = new SeriesJsonModel();
         for (int ii = 0; ii < X_DateTime.Count; ii++)
         {
             sjModel2.data.Add(null);
         }
         sjModel2.name = item[0].DataLogName + "_" + item[0].ServerIp;
         if (X_DateTime.Count <= LineMaxNum)
         {
             for (int j = 0; j < X_DateTime.Count; j++)
             {
                 for (int i = 0; i < item.Count; i++)
                 {
                     if (item[i].LogDate == X_DateTime[j])
                     {
                         DataLabels      dl        = new DataLabels();
                         SmallDataLabels smalldata = new SmallDataLabels();
                         dl.y = item[i].LogFileSize;
                         smalldata.enabled = true;
                         dl.dataLabels     = smalldata;
                         ///替换掉以前的null
                         sjModel2.data[j] = dl;
                         break;
                     }
                 }
             }
             SeriesJsonModels.Add(sjModel2);
         }
         else
         {
             for (int j = 0; j < X_DateTime.Count; j++)
             {
                 for (int i = 0; i < item.Count; i++)
                 {
                     if (item[i].LogDate == X_DateTime[j])
                     {
                         DataLabels      dl        = new DataLabels();
                         SmallDataLabels smalldata = new SmallDataLabels();
                         dl.y = item[i].LogFileSize;
                         if (j % (LineMaxNumCoef) == 0)
                         {
                             smalldata.enabled = true;
                         }
                         dl.dataLabels = smalldata;
                         ///替换掉以前的null
                         sjModel2.data[j] = dl;
                         break;
                     }
                 }
             }
             SeriesJsonModels.Add(sjModel2);
         }
     }
 }
Example #9
0
        public async Task <IActionResult> Save(string id,
                                               [FromBody] DataLabels labels)
        {
            var entity = await _db.Images.FindAsync(id);

            entity.AnnotationJson = JsonConvert.SerializeObject(labels);
            await _db.SaveChangesAsync();

            return(Ok());
        }
        /// <summary>
        /// 获取y轴数据
        /// </summary>
        /// <param name="serverIp"></param>
        /// <param name="yData"></param>
        protected void GetDataJsonList(string serverIp, List <int> yData)
        {
            ///构造一个json模型
            SeriesJsonModel sjModel2 = new SeriesJsonModel();

            for (int ii = 0; ii < yData.Count; ii++)
            {
                sjModel2.data.Add(null);
            }
            sjModel2.name = serverIp;
            if (yData.Count <= LineMaxNum)
            {
                for (int j = 0; j < yData.Count; j++)
                {
                    DataLabels      dl        = new DataLabels();
                    SmallDataLabels smalldata = new SmallDataLabels();
                    dl.y = yData[j];
                    smalldata.enabled = true;
                    dl.dataLabels     = smalldata;
                    ///替换掉以前的null
                    sjModel2.data[j] = dl;
                }
                SeriesJsonModels.Add(sjModel2);
            }
            else
            {
                for (int j = 0; j < yData.Count; j++)
                {
                    DataLabels      dl        = new DataLabels();
                    SmallDataLabels smalldata = new SmallDataLabels();
                    dl.y = yData[j];
                    if (j % (LineMaxNumCoef) == 0)
                    {
                        smalldata.enabled = true;
                    }
                    dl.dataLabels = smalldata;
                    ///替换掉以前的null
                    sjModel2.data[j] = dl;
                }
                SeriesJsonModels.Add(sjModel2);
            }
        }
Example #11
0
            /// <summary>
            /// 构造函数
            /// </summary>
            /// <param name="DataSheet">图表对应的数据工作表</param>
            /// <param name="DrawingChart">Excel图形所在的Chart对象</param>
            /// <param name="ParentApp">此图表所在的Excel类的实例对象</param>
            /// <param name="DateSpan">此图表的TimeSpan跨度</param>
            /// <param name="CanRoll">是图表是否可以滚动,即是动态图还是静态图</param>
            /// <param name="Date_ChosenDatum">一个字典,其关键字为监测数据表中有数据的每一天的日期,
            /// 对应的值为当天每一个被选择的监测点的监测数据,监测数据只包含列表中选择了的监测点</param>
            /// <param name="Info">记录数据信息的文本框</param>
            /// <remarks></remarks>
            public ClsDrawing_Mnt_OtherDynamics(Worksheet DataSheet, Chart DrawingChart,
                                                Cls_ExcelForMonitorDrawing ParentApp, DateSpan DateSpan,
                                                DrawingType type, bool CanRoll, TextFrame2 Info,
                                                MonitorInfo DrawingTag, MntType MonitorType,
                                                Dictionary <DateTime, object[]> Date_ChosenDatum,
                                                clsDrawing_Mnt_RollingBase.SeriesTag SeriesTag) : base(DataSheet, DrawingChart, ParentApp, type, CanRoll, Info, DrawingTag, MonitorType, DateSpan, SeriesTag)
            {
                //  ------------------------------------
                //为进行滚动的那条数据曲线添加数据标签
                //在数据点旁边显示数据值
                this.MovingSeries.ApplyDataLabels();
                //设置数据标签的格式
                DataLabels dataLBs = this.MovingSeries.DataLabels();

                dataLBs.NumberFormat = "0.00";
                dataLBs.Format.TextFrame2.TextRange.Font.Size = 8;
                dataLBs.Format.TextFrame2.TextRange.Font.Fill.ForeColor.RGB = Information.RGB(0, 0, 0);
                dataLBs.Format.TextFrame2.TextRange.Font.Name = AMEApplication.FontName_TNR;

                P_dicDate_ChosenDatum = Date_ChosenDatum;                 //包括第一列,但是不包括第一行的日期。
                // '' -----对图例进行更新---------
                //Call LegendRefresh(Me.List_HasCurve)
            }
        //操作系统明细数据
        protected List <SeriesJsonModel> GetDataJsonListByOsVersion(List <DateTime> x_date, List <Sjqd_StatUsersByOsVersion> osVersions)
        {
            List <SeriesJsonModel> result = new List <SeriesJsonModel>();
            ///构造一个json模型
            SeriesJsonModel sjModel2 = new SeriesJsonModel();
            ///构造对应x轴上对应各个坐标点,一开始就是null ,先填充好
            int spanInt = -(x_date.Count / 25 + 1);

            for (int ii = 0; ii < x_date.Count; ii++)
            {
                DataLabels dl = null;
                sjModel2.data.Add(dl);
            }
            sjModel2.name = "操作系统分布";
            for (int i = 0; i < osVersions.Count; i++)
            {
                for (int j = 0; j < x_date.Count; j++)
                {
                    if (x_date[j] == osVersions[i].StatDate)
                    {
                        DataLabels      dl        = new DataLabels();
                        SmallDataLabels smalldata = new SmallDataLabels();
                        dl.y          = osVersions[i].UseCount;
                        dl.dataLabels = smalldata;
                        if (j % spanInt == 0)//这个间隔和x轴设置是一样的
                        {
                            smalldata.enabled = true;
                        }
                        ///替换掉以前的null
                        sjModel2.data[j] = dl;
                    }
                }
            }
            result.Add(sjModel2);
            return(result);
        }
Example #13
0
        public static void Run()
        {
            // ExStart:ShowCellRangeAsDataLabels
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

            // Create workbook from the source Excel file
            Workbook workbook = new Workbook(dataDir + "source.xlsx");

            // Access the first worksheet
            Worksheet worksheet = workbook.Worksheets[0];

            // Access the chart inside the worksheet
            Chart chart = worksheet.Charts[0];

            // Check the "Label Contains - Value From Cells"
            DataLabels dataLabels = chart.NSeries[0].DataLabels;

            dataLabels.ShowCellRange = true;

            // Save the workbook
            workbook.Save(dataDir + "output_out.xlsx");
            // ExEnd:ShowCellRangeAsDataLabels
        }
Example #14
0
        protected List <SeriesJsonModel> GetDataJsonList(List <List <SoftUser> > temp)
        {
            foreach (List <SoftUser> item in temp)
            {
                //构造一个json模型
                SeriesJsonModel sjModel2 = new SeriesJsonModel();
                //构造对应x轴上对应各个坐标点,一开始就是null ,先填充好
                for (int ii = 0; ii < X_DateTime.Count; ii++)
                {
                    DataLabels dl = new DataLabels();
                    dl.y = 0;
                    sjModel2.data.Add(dl);
                }

                if (item.Count > 0 && X_DateTime.Count <= MaxNum)
                {
                    sjModel2.name = ((MobileOption)item[0].Platform).GetDescription();

                    for (int j = 0; j < X_DateTime.Count; j++)
                    {
                        for (int i = 0; i < item.Count; i++)
                        {
                            if (item[i].StatDate == X_DateTime[j])
                            {
                                DataLabels      dl        = new DataLabels();
                                SmallDataLabels smalldata = new SmallDataLabels();

                                dl.y = item[i].NewNum;


                                smalldata.enabled = true;
                                dl.dataLabels     = smalldata;
                                //替换掉以前的null
                                sjModel2.data[j] = dl;
                            }
                        }
                    }
                    seriesJsonStr.Add(sjModel2);
                }
                //当大于20个的时候线上的点要格一定数目显示
                else if (X_DateTime.Count > MaxNum)
                {
                    sjModel2.name = ((MobileOption)item[0].Platform).GetDescription();
                    for (int j = 0; j < X_DateTime.Count; j++)
                    {
                        for (int i = 0; i < item.Count; i++)
                        {
                            if (item[i].StatDate == X_DateTime[j])
                            {
                                DataLabels      dl        = new DataLabels();
                                SmallDataLabels smalldata = new SmallDataLabels();

                                dl.y = item[i].NewNum;
                                if (j % (MaxNumCoef) == 0)
                                {
                                    smalldata.enabled = true;
                                }

                                dl.dataLabels = smalldata;
                                //替换掉以前的null
                                sjModel2.data[j] = dl;
                            }
                        }
                    }
                    seriesJsonStr.Add(sjModel2);
                }
            }
            return(seriesJsonStr);
        }
        public static void Run()
        {
            // ExStart:CreateWorkbook
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

            // Create an instance of Workbook in XLSX format
            Workbook workbook = new Workbook(FileFormatType.Xlsx);

            // Access the first worksheet
            Worksheet worksheet = workbook.Worksheets[0];

            // Add two columns of data
            worksheet.Cells["A1"].PutValue("Retail");
            worksheet.Cells["A2"].PutValue("Services");
            worksheet.Cells["A3"].PutValue("Info & Communication");
            worksheet.Cells["A4"].PutValue("Transport Equip");
            worksheet.Cells["A5"].PutValue("Construction");
            worksheet.Cells["A6"].PutValue("Other Products");
            worksheet.Cells["A7"].PutValue("Wholesale");
            worksheet.Cells["A8"].PutValue("Land Transport");
            worksheet.Cells["A9"].PutValue("Air Transport");
            worksheet.Cells["A10"].PutValue("Electric Appliances");
            worksheet.Cells["A11"].PutValue("Securities");
            worksheet.Cells["A12"].PutValue("Textiles & Apparel");
            worksheet.Cells["A13"].PutValue("Machinery");
            worksheet.Cells["A14"].PutValue("Metal Products");
            worksheet.Cells["A15"].PutValue("Cash");
            worksheet.Cells["A16"].PutValue("Banks");

            worksheet.Cells["B1"].PutValue(10.4);
            worksheet.Cells["B2"].PutValue(5.2);
            worksheet.Cells["B3"].PutValue(6.4);
            worksheet.Cells["B4"].PutValue(10.4);
            worksheet.Cells["B5"].PutValue(7.9);
            worksheet.Cells["B6"].PutValue(4.1);
            worksheet.Cells["B7"].PutValue(3.5);
            worksheet.Cells["B8"].PutValue(5.7);
            worksheet.Cells["B9"].PutValue(3);
            worksheet.Cells["B10"].PutValue(14.7);
            worksheet.Cells["B11"].PutValue(3.6);
            worksheet.Cells["B12"].PutValue(2.8);
            worksheet.Cells["B13"].PutValue(7.8);
            worksheet.Cells["B14"].PutValue(2.4);
            worksheet.Cells["B15"].PutValue(1.8);
            worksheet.Cells["B16"].PutValue(10.1);

            // Create a pie chart and add it to the collection of charts
            int id = worksheet.Charts.Add(ChartType.Pie, 3, 3, 23, 13);

            // Access newly created Chart instance
            Chart chart = worksheet.Charts[id];

            // Set series data range
            chart.NSeries.Add("B1:B16", true);

            // Set category data range
            chart.NSeries.CategoryData = "A1:A16";

            // Turn off legend
            chart.ShowLegend = false;

            // Access data labels
            DataLabels dataLabels = chart.NSeries[0].DataLabels;

            // Turn on category names
            dataLabels.ShowCategoryName = true;

            // Turn on percentage format
            dataLabels.ShowPercentage = true;

            // Set position
            dataLabels.Position = LabelPositionType.OutsideEnd;

            // Set separator
            dataLabels.SeparatorType = DataLabelsSeparatorType.Comma;
            // ExEnd:CreateWorkbook

            // ExStart:TurnOnLeaderLines
            // Turn on leader lines
            chart.NSeries[0].HasLeaderLines = true;

            // Calculete chart
            chart.Calculate();

            // You need to move DataLabels a little leftward or rightward depending on their position to show leader lines
            int DELTA = 100;

            for (int i = 0; i < chart.NSeries[0].Points.Count; i++)
            {
                int X = chart.NSeries[0].Points[i].DataLabels.X;
                // If it is greater than 2000, then move the X position a little right otherwise move the X position a little left
                if (X > 2000)
                {
                    chart.NSeries[0].Points[i].DataLabels.X = X + DELTA;
                }
                else
                {
                    chart.NSeries[0].Points[i].DataLabels.X = X - DELTA;
                }
            }
            // ExEnd:TurnOnLeaderLines

            // ExStart:SaveChartInImageAndWorkbookInXLSX
            // In order to save the chart image, create an instance of ImageOrPrintOptions
            ImageOrPrintOptions anOption = new ImageOrPrintOptions();

            // Set image format
            anOption.ImageType = Drawing.ImageType.Png;

            // Set resolution
            anOption.HorizontalResolution = 200;
            anOption.VerticalResolution   = 200;

            // Render chart to image
            chart.ToImage(dataDir + "output_out.png", anOption);

            // Save the workbook to see chart inside the Excel
            workbook.Save(dataDir + "output_out.xlsx");
            // ExEnd:SaveChartInImageAndWorkbookInXLSX
        }
        protected string GetDataJsonList(List <Sjqd_ULSessionAvgUsers> users, List <DateTime> X_DateTime, bool isSessionLength)
        {
            List <SeriesJsonModel> seriesJsonStr = new List <SeriesJsonModel>();
            ///构造一个json模型
            SeriesJsonModel sjModel2 = new SeriesJsonModel();

            if (isSessionLength)
            {
                sjModel2.name = "人均日使用时长";
            }
            else
            {
                sjModel2.name = "人均启动次数(不区分版本)";
            }
            if (X_DateTime.Count <= MaxNum)
            {
                for (int ii = 0; ii < X_DateTime.Count; ii++)
                {
                    DataLabels dl = null;
                    sjModel2.data.Add(dl);
                }

                for (int j = 0; j < X_DateTime.Count; j++)
                {
                    foreach (Sjqd_ULSessionAvgUsers item in users)
                    {
                        if (item.StatDate == X_DateTime[j])
                        {
                            DataLabels      dl        = new DataLabels();
                            SmallDataLabels smalldata = new SmallDataLabels();
                            if (isSessionLength)
                            {
                                dl.y = (double)item.AvgSessionLength;
                            }
                            else
                            {
                                dl.y = (double)item.AvgSessions;
                            }
                            smalldata.enabled = true;
                            dl.dataLabels     = smalldata;
                            ///替换掉以前的null
                            sjModel2.data[j] = dl;
                            break;
                        }
                    }
                }
            }
            else
            {
                for (int ii = 0; ii < X_DateTime.Count; ii++)
                {
                    DataLabels dl = null;
                    sjModel2.data.Add(dl);
                }

                for (int j = 0; j < X_DateTime.Count; j++)
                {
                    foreach (Sjqd_ULSessionAvgUsers item in users)
                    {
                        if (item.StatDate == X_DateTime[j])
                        {
                            DataLabels      dl        = new DataLabels();
                            SmallDataLabels smalldata = new SmallDataLabels();
                            if (isSessionLength)
                            {
                                dl.y = (double)item.AvgSessionLength;
                            }
                            else
                            {
                                dl.y = (double)item.AvgSessions;
                            }
                            if (j % (MaxNumCoef) == 0)
                            {
                                smalldata.enabled = true;
                            }
                            dl.dataLabels = smalldata;
                            ///替换掉以前的null
                            sjModel2.data[j] = dl;
                            break;
                        }
                    }
                }
            }
            seriesJsonStr.Add(sjModel2);

            return(JsonConvert.SerializeObject(seriesJsonStr));
        }
Example #17
0
 public void Dispose()
 {
     ShapeGeometry?.Dispose();
     DataLabels?.Dispose();
 }
Example #18
0
        internal override Hashtable ToHashtable()
        {
            Hashtable hashtables                   = new Hashtable();
            bool?     allowPointSelect             = AllowPointSelect;
            bool?     allowPointSelectDefaultValue = AllowPointSelect_DefaultValue;

            if ((allowPointSelect.GetValueOrDefault() == allowPointSelectDefaultValue.GetValueOrDefault()
                                ? allowPointSelect.HasValue != allowPointSelectDefaultValue.HasValue
                                : true))
            {
                hashtables.Add("allowPointSelect", AllowPointSelect);
            }
            if (Animation.IsDirty())
            {
                hashtables.Add("animation", Animation.ToJSON());
            }
            double?animationLimit             = AnimationLimit;
            double?animationLimitDefaultValue = AnimationLimit_DefaultValue;

            if ((animationLimit.GetValueOrDefault() == animationLimitDefaultValue.GetValueOrDefault()
                                ? animationLimit.HasValue != animationLimitDefaultValue.HasValue
                                : true))
            {
                hashtables.Add("animationLimit", AnimationLimit);
            }
            if (ClassName != ClassName_DefaultValue)
            {
                hashtables.Add("className", ClassName);
            }
            if (Color != Color_DefaultValue)
            {
                hashtables.Add("color", Color);
            }
            animationLimitDefaultValue = ColorIndex;
            animationLimit             = ColorIndex_DefaultValue;
            if ((animationLimitDefaultValue.GetValueOrDefault() == animationLimit.GetValueOrDefault()
                                ? animationLimitDefaultValue.HasValue != animationLimit.HasValue
                                : true))
            {
                hashtables.Add("colorIndex", ColorIndex);
            }
            allowPointSelectDefaultValue = ConnectNulls;
            allowPointSelect             = ConnectNulls_DefaultValue;
            if ((allowPointSelectDefaultValue.GetValueOrDefault() == allowPointSelect.GetValueOrDefault()
                                ? allowPointSelectDefaultValue.HasValue != allowPointSelect.HasValue
                                : true))
            {
                hashtables.Add("connectNulls", ConnectNulls);
            }
            animationLimit             = CropThreshold;
            animationLimitDefaultValue = CropThreshold_DefaultValue;
            if ((animationLimit.GetValueOrDefault() == animationLimitDefaultValue.GetValueOrDefault()
                                ? animationLimit.HasValue != animationLimitDefaultValue.HasValue
                                : true))
            {
                hashtables.Add("cropThreshold", CropThreshold);
            }
            if (Cursor != Cursor_DefaultValue)
            {
                ArearangeSeriesCursor cursor = Cursor;
                hashtables.Add("cursor", Highcharts.FirstCharacterToLower(cursor.ToString()));
            }
            if (DashStyle != DashStyle_DefaultValue)
            {
                ArearangeSeriesDashStyle dashStyle = DashStyle;
                hashtables.Add("dashStyle", Highcharts.FirstCharacterToLower(dashStyle.ToString()));
            }
            if (Data.Any())
            {
                hashtables.Add("data", HashifyList(Data));
            }
            if (DataLabels.IsDirty())
            {
                hashtables.Add("dataLabels", DataLabels.ToHashtable());
            }
            if (Description != Description_DefaultValue)
            {
                hashtables.Add("description", Description);
            }
            allowPointSelect             = EnableMouseTracking;
            allowPointSelectDefaultValue = EnableMouseTracking_DefaultValue;
            if ((allowPointSelect.GetValueOrDefault() == allowPointSelectDefaultValue.GetValueOrDefault()
                                ? allowPointSelect.HasValue != allowPointSelectDefaultValue.HasValue
                                : true))
            {
                hashtables.Add("enableMouseTracking", EnableMouseTracking);
            }
            if (Events.IsDirty())
            {
                hashtables.Add("events", Events.ToHashtable());
            }
            if (FillColor != FillColor_DefaultValue)
            {
                hashtables.Add("fillColor", FillColor);
            }
            animationLimitDefaultValue = FillOpacity;
            animationLimit             = FillOpacity_DefaultValue;
            if ((animationLimitDefaultValue.GetValueOrDefault() == animationLimit.GetValueOrDefault()
                                ? animationLimitDefaultValue.HasValue != animationLimit.HasValue
                                : true))
            {
                hashtables.Add("fillOpacity", FillOpacity);
            }
            allowPointSelectDefaultValue = GetExtremesFromAll;
            allowPointSelect             = GetExtremesFromAll_DefaultValue;
            if ((allowPointSelectDefaultValue.GetValueOrDefault() == allowPointSelect.GetValueOrDefault()
                                ? allowPointSelectDefaultValue.HasValue != allowPointSelect.HasValue
                                : true))
            {
                hashtables.Add("getExtremesFromAll", GetExtremesFromAll);
            }
            if (Id != Id_DefaultValue)
            {
                hashtables.Add("id", Id);
            }
            animationLimit             = Index;
            animationLimitDefaultValue = Index_DefaultValue;
            if ((animationLimit.GetValueOrDefault() == animationLimitDefaultValue.GetValueOrDefault()
                                ? animationLimit.HasValue != animationLimitDefaultValue.HasValue
                                : true))
            {
                hashtables.Add("index", Index);
            }
            if (Keys != Keys_DefaultValue)
            {
                hashtables.Add("keys", Keys);
            }
            animationLimitDefaultValue = LegendIndex;
            animationLimit             = LegendIndex_DefaultValue;
            if ((animationLimitDefaultValue.GetValueOrDefault() == animationLimit.GetValueOrDefault()
                                ? animationLimitDefaultValue.HasValue != animationLimit.HasValue
                                : true))
            {
                hashtables.Add("legendIndex", LegendIndex);
            }
            if (LineColor != LineColor_DefaultValue)
            {
                hashtables.Add("lineColor", LineColor);
            }
            animationLimit             = LineWidth;
            animationLimitDefaultValue = LineWidth_DefaultValue;
            if ((animationLimit.GetValueOrDefault() == animationLimitDefaultValue.GetValueOrDefault()
                                ? animationLimit.HasValue != animationLimitDefaultValue.HasValue
                                : true))
            {
                hashtables.Add("lineWidth", LineWidth);
            }
            if (Linecap != Linecap_DefaultValue)
            {
                ArearangeSeriesLinecap linecap = Linecap;
                hashtables.Add("linecap", Highcharts.FirstCharacterToLower(linecap.ToString()));
            }
            if (LinkedTo != LinkedTo_DefaultValue)
            {
                hashtables.Add("linkedTo", LinkedTo);
            }
            if (Name != Name_DefaultValue)
            {
                hashtables.Add("name", Name);
            }
            if (NegativeColor != NegativeColor_DefaultValue)
            {
                hashtables.Add("negativeColor", NegativeColor);
            }
            if (NegativeFillColor != NegativeFillColor_DefaultValue)
            {
                hashtables.Add("negativeFillColor", NegativeFillColor);
            }
            if (Point.IsDirty())
            {
                hashtables.Add("point", Point.ToHashtable());
            }
            animationLimitDefaultValue = PointInterval;
            animationLimit             = PointInterval_DefaultValue;
            if ((animationLimitDefaultValue.GetValueOrDefault() == animationLimit.GetValueOrDefault()
                                ? animationLimitDefaultValue.HasValue != animationLimit.HasValue
                                : true))
            {
                hashtables.Add("pointInterval", PointInterval);
            }
            if (PointIntervalUnit != PointIntervalUnit_DefaultValue)
            {
                ArearangeSeriesPointIntervalUnit pointIntervalUnit = PointIntervalUnit;
                hashtables.Add("pointIntervalUnit", Highcharts.FirstCharacterToLower(pointIntervalUnit.ToString()));
            }
            if (PointPlacement.IsDirty())
            {
                hashtables.Add("pointPlacement", PointPlacement.ToJSON());
            }
            animationLimit             = PointStart;
            animationLimitDefaultValue = PointStart_DefaultValue;
            if ((animationLimit.GetValueOrDefault() == animationLimitDefaultValue.GetValueOrDefault()
                                ? animationLimit.HasValue != animationLimitDefaultValue.HasValue
                                : true))
            {
                hashtables.Add("pointStart", PointStart);
            }
            allowPointSelect             = Selected;
            allowPointSelectDefaultValue = Selected_DefaultValue;
            if ((allowPointSelect.GetValueOrDefault() == allowPointSelectDefaultValue.GetValueOrDefault()
                                ? allowPointSelect.HasValue != allowPointSelectDefaultValue.HasValue
                                : true))
            {
                hashtables.Add("selected", Selected);
            }
            if (Shadow != Shadow_DefaultValue)
            {
                hashtables.Add("shadow", Shadow);
            }
            allowPointSelectDefaultValue = ShowCheckbox;
            allowPointSelect             = ShowCheckbox_DefaultValue;
            if ((allowPointSelectDefaultValue.GetValueOrDefault() == allowPointSelect.GetValueOrDefault()
                                ? allowPointSelectDefaultValue.HasValue != allowPointSelect.HasValue
                                : true))
            {
                hashtables.Add("showCheckbox", ShowCheckbox);
            }
            allowPointSelect             = ShowInLegend;
            allowPointSelectDefaultValue = ShowInLegend_DefaultValue;
            if ((allowPointSelect.GetValueOrDefault() == allowPointSelectDefaultValue.GetValueOrDefault()
                                ? allowPointSelect.HasValue != allowPointSelectDefaultValue.HasValue
                                : true))
            {
                hashtables.Add("showInLegend", ShowInLegend);
            }
            if (States.IsDirty())
            {
                hashtables.Add("states", States.ToHashtable());
            }
            if (Step != Step_DefaultValue)
            {
                ArearangeSeriesStep step = Step;
                hashtables.Add("step", Highcharts.FirstCharacterToLower(step.ToString()));
            }
            allowPointSelectDefaultValue = StickyTracking;
            allowPointSelect             = StickyTracking_DefaultValue;
            if ((allowPointSelectDefaultValue.GetValueOrDefault() == allowPointSelect.GetValueOrDefault()
                                ? allowPointSelectDefaultValue.HasValue != allowPointSelect.HasValue
                                : true))
            {
                hashtables.Add("stickyTracking", StickyTracking);
            }
            if (Tooltip.IsDirty())
            {
                hashtables.Add("tooltip", Tooltip.ToHashtable());
            }
            allowPointSelect             = TrackByArea;
            allowPointSelectDefaultValue = TrackByArea_DefaultValue;
            if ((allowPointSelect.GetValueOrDefault() == allowPointSelectDefaultValue.GetValueOrDefault()
                                ? allowPointSelect.HasValue != allowPointSelectDefaultValue.HasValue
                                : true))
            {
                hashtables.Add("trackByArea", TrackByArea);
            }
            animationLimitDefaultValue = TurboThreshold;
            animationLimit             = TurboThreshold_DefaultValue;
            if ((animationLimitDefaultValue.GetValueOrDefault() == animationLimit.GetValueOrDefault()
                                ? animationLimitDefaultValue.HasValue != animationLimit.HasValue
                                : true))
            {
                hashtables.Add("turboThreshold", TurboThreshold);
            }
            if (Type != Type_DefaultValue)
            {
                ArearangeSeriesType type = Type;
                hashtables.Add("type", Highcharts.FirstCharacterToLower(type.ToString()));
            }
            allowPointSelectDefaultValue = Visible;
            allowPointSelect             = Visible_DefaultValue;
            if ((allowPointSelectDefaultValue.GetValueOrDefault() == allowPointSelect.GetValueOrDefault()
                                ? allowPointSelectDefaultValue.HasValue != allowPointSelect.HasValue
                                : true))
            {
                hashtables.Add("visible", Visible);
            }
            if (XAxis != XAxis_DefaultValue)
            {
                hashtables.Add("xAxis", XAxis);
            }
            if (YAxis != YAxis_DefaultValue)
            {
                hashtables.Add("yAxis", YAxis);
            }
            animationLimit             = ZIndex;
            animationLimitDefaultValue = ZIndex_DefaultValue;
            if ((animationLimit.GetValueOrDefault() == animationLimitDefaultValue.GetValueOrDefault()
                                ? animationLimit.HasValue != animationLimitDefaultValue.HasValue
                                : true))
            {
                hashtables.Add("zIndex", ZIndex);
            }
            if (ZoneAxis != ZoneAxis_DefaultValue)
            {
                hashtables.Add("zoneAxis", ZoneAxis);
            }
            if (Zones.IsDirty())
            {
                hashtables.Add("zones", Zones.ToHashtable());
            }
            return(hashtables);
        }
Example #19
0
 internal DataLabelsConfigurator(DataLabels dataLabels)
 {
     this.dataLabels = dataLabels;
 }
Example #20
0
        //最近三十天数据
        private List <SeriesJsonModel> GetDataJsonList(List <DateTime> x_date, List <SoftUser> softs, int type)
        {
            List <SeriesJsonModel> result = new List <SeriesJsonModel>();
            ///构造一个json模型
            SeriesJsonModel sjModel2 = new SeriesJsonModel();

            ///构造对应x轴上对应各个坐标点,一开始就是null ,先填充好
            for (int ii = 0; ii < x_date.Count; ii++)
            {
                DataLabels dl = null;
                sjModel2.data.Add(dl);
            }
            if (type == 2)
            {
                for (int i = 0; i < softs.Count; i++)
                {
                    sjModel2.name = "活跃";
                    for (int j = 0; j < x_date.Count; j++)
                    {
                        if (x_date[j] == softs[i].StatDate)
                        {
                            DataLabels      dl        = new DataLabels();
                            SmallDataLabels smalldata = new SmallDataLabels();

                            dl.y = softs[i].ActiveNum;


                            dl.dataLabels = smalldata;
                            if (j % (-3) == 0)//这个间隔和x轴设置是一样的
                            {
                                smalldata.enabled = true;
                            }
                            ///替换掉以前的null
                            sjModel2.data[j] = dl;
                        }
                    }
                }
            }
            else
            {
                for (int i = 0; i < softs.Count; i++)
                {
                    sjModel2.name = "新增";
                    for (int j = 0; j < x_date.Count; j++)
                    {
                        if (x_date[j] == softs[i].StatDate)
                        {
                            DataLabels      dl        = new DataLabels();
                            SmallDataLabels smalldata = new SmallDataLabels();

                            dl.y = softs[i].NewNum;


                            dl.dataLabels = smalldata;
                            if (j % (-3) == 0)//这个间隔和x轴设置是一样的
                            {
                                smalldata.enabled = true;
                            }
                            ///替换掉以前的null
                            sjModel2.data[j] = dl;
                        }
                    }
                }
            }
            result.Add(sjModel2);

            return(result);
        }