本文整理汇总了C#中ConstructGen.ToDataTable方法的典型用法代码示例。如果您正苦于以下问题:C# ConstructGen.ToDataTable方法的具体用法?C# ConstructGen.ToDataTable怎么用?C# ConstructGen.ToDataTable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConstructGen
的用法示例。
在下文中一共展示了ConstructGen.ToDataTable方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Create
public void Create(ConstructGen<double> wts_, FXGroup[] groups_)
{
ConstructGen<double> groupConv = new ConstructGen<double>(groups_.Length);
groupConv.ColumnHeadings = groups_.Select(x => x.ToString()).ToArray();
Currency[] ccys = wts_.ColumnHeadings.Select(x => Singleton<FXIDs>.Instance[x]).ToArray();
List<int[]> indicies =new List<int[]>();
foreach(FXGroup group in groups_)
{
List<int> groupIndicies=new List<int>();
for(int i=0;i<ccys.Length;++i)
if(ccys[i].IsGroup(group))
groupIndicies.Add(i);
indicies.Add(groupIndicies.ToArray());
}
foreach (DateTime date in wts_.Dates)
{
double[] dateWeights = wts_.GetValues(date);
double[] buckets = new double[groups_.Length];
for(int g=0;g<groups_.Length;++g)
foreach (int index in indicies[g])
buckets[g] += dateWeights[index];
groupConv.SetValues(date, buckets);
}
DataTable dt1 = groupConv.ToDataTable(groupConv.ColumnHeadings, "Date", "dd-MMM-yyyy");
Chart.ChartType = Infragistics.UltraChart.Shared.Styles.ChartType.Composite;
ChartArea area = new ChartArea();
Chart.CompositeChart.ChartAreas.Add(area);
AxisItem axisY = new AxisItem();
axisY.Extent = 50;
axisY.DataType = AxisDataType.Numeric;
axisY.OrientationType = AxisNumber.Y_Axis;
axisY.LineColor = Color.Blue;
axisY.Labels.Visible = true;
area.Axes.Add(axisY);
AxisItem axisX = new AxisItem();
axisX.DataType = AxisDataType.String;
axisX.Extent = 80;
axisX.SetLabelAxisType = Infragistics.UltraChart.Core.Layers.SetLabelAxisType.GroupBySeries;
axisX.OrientationType = AxisNumber.X_Axis;
axisX.LineColor = Color.Blue;
axisX.Labels.Orientation = TextOrientation.VerticalLeftFacing;
axisX.Labels.SeriesLabels.Orientation = TextOrientation.VerticalLeftFacing;
area.Axes.Add(axisX);
AxisItem axisX2 = new AxisItem();
axisX2.DataType = AxisDataType.String;
axisX2.Extent = 80;
axisX2.OrientationType = AxisNumber.X_Axis;
axisX2.LineColor = Color.Blue;
axisX2.Labels.Orientation = TextOrientation.VerticalLeftFacing;
axisX2.Labels.SeriesLabels.Orientation = TextOrientation.VerticalLeftFacing;
axisX2.SetLabelAxisType = SetLabelAxisType.ContinuousData;
area.Axes.Add(axisX2);
ChartLayerAppearance myColumnLayer = new ChartLayerAppearance();
myColumnLayer.ChartType = ChartType.StackColumnChart;
myColumnLayer.ChartArea = area;
foreach (FXGroup group in groups_)
{
NumericSeries series1 = new NumericSeries();
series1.Key = group.ToString();
series1.DataBind(dt1, group.ToString(), "Date");
series1.PEs.Add(new PaintElement(ColorAttribute.GetAttribute(group).Color));
myColumnLayer.Series.Add(series1);
Chart.CompositeChart.Series.Add(series1);
}
DataTable dt2 = wts_.SumRows().ToDataTable(format_:"dd-MMM-yyyy");
ChartLayerAppearance myColumnLayer2 = new ChartLayerAppearance();
myColumnLayer2.ChartType = ChartType.LineChart;
myColumnLayer2.ChartArea = area;
NumericSeries seriesA = new NumericSeries();
seriesA.Key = "Sum of Wts";
seriesA.DataBind(dt2, "Value", "Date");
seriesA.PEs.Add(new PaintElement(Color.Orange));
myColumnLayer2.Series.Add(seriesA);
Chart.CompositeChart.Series.Add(seriesA);
LineChartAppearance la = new LineChartAppearance();
la.Thickness = 4;
myColumnLayer2.ChartTypeAppearance = la;
myColumnLayer.AxisX = axisX;
myColumnLayer.AxisY = axisY;
//.........这里部分代码省略.........