本文整理汇总了C#中IBin.Select方法的典型用法代码示例。如果您正苦于以下问题:C# IBin.Select方法的具体用法?C# IBin.Select怎么用?C# IBin.Select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IBin
的用法示例。
在下文中一共展示了IBin.Select方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawBars
private void DrawBars(IBin[] bins, CanvasDrawingSession session, CanvasControl canvas)
{
if (bins.Length == 0)
{
return;
}
double[] binValues = bins.Select(b => b.Value).ToArray();
double[] secondaryValues = null;
if (ShowSecondary)
{
secondaryValues = bins.Select(b => b.SecondaryValue).ToArray();
}
if (!DrawPrimaryFirst && ShowSecondary)
{
double[] temp = binValues;
binValues = secondaryValues;
secondaryValues = temp;
}
double maxBarHeight = canvas.ActualHeight - (BarPadding.Top + BarPadding.Bottom) - LabelSize.Height;
int binCount = binValues.Length;
double barWidth = canvas.ActualWidth / binCount;
double maxValue = MaxValue;
if (maxValue == 0)
{
maxValue = binValues.Max();
if (secondaryValues != null)
{
maxValue = Math.Max(maxValue, secondaryValues.Max());
}
}
double minValue = MinValue;
if (minValue > 0)
{
maxValue = Math.Max(minValue, maxValue);
}
double valueFactor = Math.Max(maxBarHeight / maxValue, 0);
Color barColor = BarColor;
Color secondaryBarColor = SecondaryBarColor;
Color highlightColor = HighlightBarColor;
for (int barIndex = 0; barIndex < binValues.Length; barIndex++)
{
double value = binValues[barIndex];
double left = barIndex * barWidth;
Rect r = new Rect();
r.X = left + BarPadding.Left;
r.Width = Math.Max(barWidth - (BarPadding.Left + BarPadding.Right), 0.1);
if (secondaryValues != null)
{
double secondaryValue = secondaryValues[barIndex];
r.Height = secondaryValue * valueFactor;
r.Y = maxBarHeight + BarPadding.Top - r.Height;
session.FillRectangle(r, secondaryBarColor);
}
r.Height = value * valueFactor;
r.Y = maxBarHeight + BarPadding.Top - r.Height;
if (bins[barIndex].IsHighlighted)
{
session.FillRectangle(r, highlightColor);
}
else
{
session.FillRectangle(r, barColor);
}
}
}