I am currently working on creating a series for my box-plot chart in C# that I will be using in an Angular application. I have set the TSType attribute on the classes to convert them into TypeScript files, but I am struggling with matching the class structure to the TypeScript structure and initializing the data, name, and color due to compile-time errors.
The TypeScript structure I am trying to achieve is as follows:
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# code snippet:
[TsType]
public class BoxPlotSeries
{
public string Color { get; set; }
public string Name { 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; }
}
}
[TsType]
public class EvaResults
{
public int[] CapitalViewYear { get; set; }
// Other properties...
public SeriesGeneric<BoxPlotSeries> ChartSeries
{
get
{
BoxPlotSeries captiveViewSeriesData = null;
// Initialize captiveViewSeriesData
BoxPlotSeries parentViewSeriesData = null;
// Initialize parentViewSeriesData
return new SeriesGeneric<BoxPlotSeries>
{
Data = new List<BoxPlotSeries> { captiveViewSeriesData, parentViewSeriesData }
};
}
}
}
If you have any suggestions or corrections, please let me know!