Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/340.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/30.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
用c#为角度海图构建海图系列_C#_Angular_Typescript - Fatal编程技术网

用c#为角度海图构建海图系列

用c#为角度海图构建海图系列,c#,angular,typescript,C#,Angular,Typescript,我正在尝试为我的方框图构建系列,我将在我的角度应用程序中使用它。但是,该系列需要在c#中构建。您会注意到,我已经在类上设置了TSType属性,这些类将把它们转换为typescript文件。我不确定类结构应该如何匹配Typescript结构。请注意,由于通用功能,我使用了泛型。如果您注意到在我的c#代码中,我正在尝试初始化EvaResults类的ChartSeries属性中的序列。当我遇到编译时错误时,如何初始化数据、名称和颜色 我试图实现的类型脚本结构是 this.series = [{

我正在尝试为我的方框图构建系列,我将在我的角度应用程序中使用它。但是,该系列需要在c#中构建。您会注意到,我已经在类上设置了TSType属性,这些类将把它们转换为typescript文件。我不确定类结构应该如何匹配Typescript结构。请注意,由于通用功能,我使用了泛型。如果您注意到在我的c#代码中,我正在尝试初始化EvaResults类的ChartSeries属性中的序列。当我遇到编译时错误时,如何初始化数据、名称和颜色

我试图实现的类型脚本结构是

 this.series = [{
            name: 'Captive Options',
            color: "#5D63D3",
            data: [
                {
                    high: 1381733.354653,
                    low: 1375002.43018757,
                    median: 1378397.06388383,
                    q1: 1377657.3051449,
                    q3: 1379137.30789384
                }]
        }, {
            name: 'Self Insurance Option',
            color: "#FFB81C",
            data: [{
                high: 31571.3633337259,
                low: 25798.8488509699,
                median: 28811.9158552374,
                q1: 28152.937211967,
                q3: 29440.3428303377
            }]
        }];
C#代码

[TsType]
公共类BoxPlotSeries
{
公共字符串颜色{get;set;}
公共字符串名称{get;set;}
公共类数据
{
公共十进制低位{get;set;}
公共十进制Q1{get;set;}
公共十进制中值{get;set;}
公共十进制Q3{get;set;}
公共十进制高位{get;set;}
}
}
[TsType]
公开课成绩
{
public int[]CapitalViewYear{get;set;}
公共十进制[]CapitalViewCapitalNetIncome{get;set;}
公共十进制[]CapitalViewSurplusDeployed{get;set;}
公共十进制[]CapitalViewGraphData{get;set;}
公共十进制[]ParentViewCostOfCapDeployed{get;set;}
公共十进制[]ParentViewCostOfRiskArb{get;set;}
公共十进制[]ParentViewIncrCost{get;set;}
公共十进制[]ParentViewOutput{get;set;}
public decimal[]parentview盈余部署{get;set;}
公共十进制[]ParentViewNpvBenefit{get;set;}
公共十进制[]ParentViewGraphData{get;set;}
公共系列通用图表系列
{
得到
{
BoxPlotSeries captiveViewSeriesData=null;
if(CapitalViewGraphData!=null&&CapitalViewGraphData.Length>=5)
{
captiveViewSeriesData=新的BoxPlotSeries();
captiveViewSeriesData.Name=“Captive”;
captiveViewSeriesData.Color=“#FFB81C”;
captiveViewSeriesData=新的BoxPlot系列
{
低=CapitalViewGraphData[0],
Q1=CapitalViewGraphData[1],
中位数=CapitalViewGraphData[2],
Q3=CapitalViewGraphData[3],
高=CapitalViewGraphData[4],
};
}
//父视图
BoxPlotSeries parentViewSeriesData=null;
if(ParentViewGraphData!=null&&ParentViewGraphData.Length>=5)
{
parentViewSeriesData=新的BoxPlotSeries();
parentViewSeriesData.Name=“母公司”;
captiveViewSeriesData.Color=“#C111A0”;
parentViewSeriesData=新的BoxPlotSeries
{
低=ParentViewGraphData[0],
Q1=ParentViewGraphData[1],
中位数=ParentViewGraphData[2],
Q3=ParentViewGraphData[3],
高=ParentViewGraphData[4],
Color=“#c11a0”,
Name=“母公司”//TODO:本地化
};
}
返回新序列Generic
{
数据=新列表{captiveViewSeriesData,parentViewSeriesData}
};
}
}
}
我已经试过下面的方法了,但是不起作用

 public SeriesGeneric<BoxPlotSeries> ChartSeries
        {
            get
            {
                BoxPlotSeries captiveViewSeriesData = null;
                if (CapitalViewGraphData != null && CapitalViewGraphData.Length >= 5)
                {
                    captiveViewSeriesData = new BoxPlotSeries();
                    captiveViewSeriesData.color = "#FFB81C";
                    captiveViewSeriesData.name = "Captive";
                    captiveViewSeriesData.data = new Data();
                    captiveViewSeriesData.data.Low = CapitalViewGraphData[0];
                    captiveViewSeriesData.data.Q1 = CapitalViewGraphData[1];
                    captiveViewSeriesData.data.Median = CapitalViewGraphData[2];
                    captiveViewSeriesData.data.Q3 = CapitalViewGraphData[3];
                    captiveViewSeriesData.data.High = CapitalViewGraphData[4];
                }

                //ParentView
                BoxPlotSeries parentViewSeriesData = null;
                if (ParentViewGraphData != null && ParentViewGraphData.Length >= 5)
                {
                    parentViewSeriesData = new BoxPlotSeries();
                    parentViewSeriesData.color = "#C111A0";
                    parentViewSeriesData.name = "Parent Company";
                    parentViewSeriesData.data = new Data();
                    parentViewSeriesData.data.Low = CapitalViewGraphData[0];
                    parentViewSeriesData.data.Q1 = CapitalViewGraphData[1];
                    parentViewSeriesData.data.Median = CapitalViewGraphData[2];
                    parentViewSeriesData.data.Q3 = CapitalViewGraphData[3];
                    parentViewSeriesData.data.High = CapitalViewGraphData[4];
                }                               

                return new SeriesGeneric<BoxPlotSeries>
                {
                    Data = new List<BoxPlotSeries> { captiveViewSeriesData, parentViewSeriesData }
                };
            }
公共系列通用图表系列
{
得到
{
BoxPlotSeries captiveViewSeriesData=null;
if(CapitalViewGraphData!=null&&CapitalViewGraphData.Length>=5)
{
captiveViewSeriesData=新的BoxPlotSeries();
captiveViewSeriesData.color=“#FFB81C”;
captiveViewSeriesData.name=“Captive”;
captiveViewSeriesData.data=新数据();
captiveViewSeriesData.data.Low=CaptiveViewGraphData[0];
captiveViewSeriesData.Q1=CaptiveViewGraphData[1];
captiveViewSeriesData.data.Median=CaptiveViewGraphData[2];
captiveViewSeriesData.Q3=CaptiveViewGraphData[3];
captiveViewSeriesData.data.High=CaptiveViewGraphData[4];
}
//父视图
BoxPlotSeries parentViewSeriesData=null;
if(ParentViewGraphData!=null&&ParentViewGraphData.Length>=5)
{
parentViewSeriesData=新的BoxPlotSeries();
parentViewSeriesData.color=“#C111A0”;
parentViewSeriesData.name=“母公司”;
parentViewSeriesData.data=新数据();
parentViewSeriesData.data.Low=CapitalViewGraphData[0];
parentViewSeriesData.data.Q1=CapitalViewGraphData[1];
parentViewSeriesData.data.Median=CapitalViewGraphData[2];
parentViewSeriesData.data.Q3=CapitalViewGraphData[3];
parentViewSeriesData.data.High=CapitalViewGraphData[4];
}                               
返回新序列Generic
{
数据=新列表{captiveViewSeriesData,parentViewSeriesData}
};
}
根据您的建议,我尝试了此操作,但不了解添加到seriesdata对象的意义,因为我不返回该对象。如果返回该对象,则会出现类型错误

public SeriesGeneric<BoxPlotSeries> ChartSeries
        {
            get
            {
                List<BoxPlotSeries> seriesData = null;
                seriesData = new List<BoxPlotSeries>();
                BoxPlotSeries captiveInsSeriesData = new BoxPlotSeries();
                if (CaptiveInsGraphData != null)
                {

                    captiveInsSeriesData.color = "#5D63D3";
                    captiveInsSeriesData.name = "Captive Options";
                    captiveInsSeriesData.data = new Data();
                    captiveInsSeriesData.data.Low = CaptiveInsGraphData[0];
                    captiveInsSeriesData.data.Q1 = CaptiveInsGraphData[1];
                    captiveInsSeriesData.data.Median = CaptiveInsGraphData[2];
                    captiveInsSeriesData.data.Q3 = CaptiveInsGraphData[3];
                    captiveInsSeriesData.data.High = CaptiveInsGraphData[4];
                    seriesData.Add(captiveInsSeriesData);
                }

                //CommIns
               // BoxPlotSeries commInsSeriesData = null;
                BoxPlotSeries commInsSeriesData = new BoxPlotSeries();

                if (CommInsGraphData != null)
                {
                    //BoxPlotSeries commInsSeriesData = new BoxPlotSeries();
                    commInsSeriesData.color = "#C111A0";
                    commInsSeriesData.name = "Commercial Option";
                    commInsSeriesData.data = new Data();
                    commInsSeriesData.data.Low = CommInsGraphData[0];
                    commInsSeriesData.data.Q1 = CommInsGraphData[1];
                    commInsSeriesData.data.Median = CommInsGraphData[2];
                    commInsSeriesData.data.Q3 = CommInsGraphData[3];
                    commInsSeriesData.data.High = CommInsGraphData[4];
                    seriesData.Add(commInsSeriesData);
                }
                //SelfIns
                //BoxPlotSeries selfInsSeriesData = null;
                BoxPlotSeries selfInsSeriesData = new BoxPlotSeries();
                if (SelfInsGraphData != null)
                {

                    //BoxPlotSeries selfInsSeriesData = new BoxPlotSeries();
                    selfInsSeriesData.color = "#FFB81C";
                    selfInsSeriesData.name = "Self Insurance Option";
                    selfInsSeriesData.data = new Data();
                    selfInsSeriesData.data.Low = CommInsGraphData[0];
                    selfInsSeriesData.data.Q1 = CommInsGraphData[1];
                    selfInsSeriesData.data.Median = CommInsGraphData[2];
                    selfInsSeriesData.data.Q3 = CommInsGraphData[3];
                    selfInsSeriesData.data.High = CommInsGraphData[4];
                    seriesData.Add(selfInsSeriesData);
                }

                return new SeriesGeneric<BoxPlotSeries>
                {
                    Data = new List<BoxPlotSeries> { captiveInsSeriesData, commInsSeriesData, selfInsSeriesData }
                };
            }
        }
public SeriesGeneric<BoxPlotSeries> ChartSeries { get { List<BoxPlotSeries> seriesData = null; seriesData = new List<BoxPlotSeries>(); BoxPlotSeries captiveInsSeriesData = new BoxPlotSeries(); if (CaptiveInsGraphData != null) { captiveInsSeriesData.color = "#5D63D3"; captiveInsSeriesData.name = "Captive Options"; captiveInsSeriesData.data = new Data(); captiveInsSeriesData.data.Low = CaptiveInsGraphData[0]; captiveInsSeriesData.data.Q1 = CaptiveInsGraphData[1]; captiveInsSeriesData.data.Median = CaptiveInsGraphData[2]; captiveInsSeriesData.data.Q3 = CaptiveInsGraphData[3]; captiveInsSeriesData.data.High = CaptiveInsGraphData[4]; seriesData.Add(captiveInsSeriesData); } //CommIns // BoxPlotSeries commInsSeriesData = null; BoxPlotSeries commInsSeriesData = new BoxPlotSeries(); if (CommInsGraphData != null) { //BoxPlotSeries commInsSeriesData = new BoxPlotSeries(); commInsSeriesData.color = "#C111A0"; commInsSeriesData.name = "Commercial Option"; commInsSeriesData.data = new Data(); commInsSeriesData.data.Low = CommInsGraphData[0]; commInsSeriesData.data.Q1 = CommInsGraphData[1]; commInsSeriesData.data.Median = CommInsGraphData[2]; commInsSeriesData.data.Q3 = CommInsGraphData[3]; commInsSeriesData.data.High = CommInsGraphData[4]; seriesData.Add(commInsSeriesData); } //SelfIns //BoxPlotSeries selfInsSeriesData = null; BoxPlotSeries selfInsSeriesData = new BoxPlotSeries(); if (SelfInsGraphData != null) { //BoxPlotSeries selfInsSeriesData = new BoxPlotSeries(); selfInsSeriesData.color = "#FFB81C"; selfInsSeriesData.name = "Self Insurance Option"; selfInsSeriesData.data = new Data(); selfInsSeriesData.data.Low = CommInsGraphData[0]; selfInsSeriesData.data.Q1 = CommInsGraphData[1]; selfInsSeriesData.data.Median = CommInsGraphData[2]; selfInsSeriesData.data.Q3 = CommInsGraphData[3]; selfInsSeriesData.data.High = CommInsGraphData[4]; seriesData.Add(selfInsSeriesData); } return new SeriesGeneric<BoxPlotSeries> { Data = new List<BoxPlotSeries> { captiveInsSeriesData, commInsSeriesData, selfInsSeriesData } }; } }
public class BoxPlotSeries
    {
        public string color { get; set; }
        public string name { get; set; }
        public Data data { get; set; }

        public class Data
        {
            public decimal Low { get; set; }

            public decimal Q1 { get; set; }

            public decimal Median { get; set; }

            public decimal Q3 { get; set; }

            public decimal High { get; set; }
        }
    }
 //Declaration
  captiveViewSeriesData = new List<BoxPlotSeries>();

 //Initialize
  //here posible for or foreach 
   BoxPlotSeries obj = new BoxPlotSeries();
   obj.color="#FF00FF";
   obj.name="Peter";   
   obj.data = new Data();
   obj.data.Low = 0.5;
   obj.data.Q1= 0.5;  
   obj.data.Median= 0.5;
   obj.data.Q3 = 0.5;
   obj.data.High = 0.5;
   captiveViewSeriesData.Add(obj);
  // close posible for or foreach