本文整理汇总了C#中PdfSharp.Charting.Renderers.RendererParameters类的典型用法代码示例。如果您正苦于以下问题:C# RendererParameters类的具体用法?C# RendererParameters怎么用?C# RendererParameters使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RendererParameters类属于PdfSharp.Charting.Renderers命名空间,在下文中一共展示了RendererParameters类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Draw
/// <summary>
/// Draws the legend.
/// </summary>
internal override void Draw()
{
ChartRendererInfo cri = (ChartRendererInfo)this.rendererParms.RendererInfo;
LegendRendererInfo lri = cri.legendRendererInfo;
if (lri == null)
return;
XGraphics gfx = this.rendererParms.Graphics;
RendererParameters parms = new RendererParameters();
parms.Graphics = gfx;
LegendEntryRenderer ler = new LegendEntryRenderer(parms);
bool verticalLegend = (lri.legend.docking == DockingType.Left || lri.legend.docking == DockingType.Right);
int paddingFactor = 1;
if (lri.BorderPen != null)
paddingFactor = 2;
XRect legendRect = lri.Rect;
legendRect.X += LegendRenderer.LeftPadding * paddingFactor;
if (verticalLegend)
legendRect.Y = legendRect.Bottom - LegendRenderer.BottomPadding * paddingFactor;
else
legendRect.Y += LegendRenderer.TopPadding * paddingFactor;
foreach (LegendEntryRendererInfo leri in cri.legendRendererInfo.Entries)
{
if (verticalLegend)
legendRect.Y -= leri.Height;
XRect entryRect = legendRect;
entryRect.Width = leri.Width;
entryRect.Height = leri.Height;
leri.Rect = entryRect;
parms.RendererInfo = leri;
ler.Draw();
if (verticalLegend)
legendRect.Y -= LegendRenderer.EntrySpacing;
else
legendRect.X += entryRect.Width + LegendRenderer.EntrySpacing;
}
// Draw border around legend
if (lri.BorderPen != null)
{
XRect borderRect = lri.Rect;
borderRect.X += LegendRenderer.LeftPadding;
borderRect.Y += LegendRenderer.TopPadding;
borderRect.Width -= LegendRenderer.LeftPadding + LegendRenderer.RightPadding;
borderRect.Height -= LegendRenderer.TopPadding + LegendRenderer.BottomPadding;
gfx.DrawRectangle(lri.BorderPen, borderRect);
}
}
示例2: Format
/// <summary>
/// Layouts and calculates the space used by the legend.
/// </summary>
internal override void Format()
{
ChartRendererInfo cri = (ChartRendererInfo)this.rendererParms.RendererInfo;
LegendRendererInfo lri = cri.legendRendererInfo;
if (lri == null)
return;
RendererParameters parms = new RendererParameters();
parms.Graphics = this.rendererParms.Graphics;
bool verticalLegend = (lri.legend.docking == DockingType.Left || lri.legend.docking == DockingType.Right);
XSize maxMarkerArea = new XSize();
LegendEntryRenderer ler = new LegendEntryRenderer(parms);
foreach (LegendEntryRendererInfo leri in lri.Entries)
{
parms.RendererInfo = leri;
ler.Format();
maxMarkerArea.Width = Math.Max(leri.MarkerArea.Width, maxMarkerArea.Width);
maxMarkerArea.Height = Math.Max(leri.MarkerArea.Height, maxMarkerArea.Height);
if (verticalLegend)
{
lri.Width = Math.Max(lri.Width, leri.Width);
lri.Height += leri.Height;
}
else
{
lri.Width += leri.Width;
lri.Height = Math.Max(lri.Height, leri.Height);
}
}
// Add padding to left, right, top and bottom
int paddingFactor = 1;
if (lri.BorderPen != null)
paddingFactor = 2;
lri.Width += (LegendRenderer.LeftPadding + LegendRenderer.RightPadding) * paddingFactor;
lri.Height += (LegendRenderer.TopPadding + LegendRenderer.BottomPadding) * paddingFactor;
if (verticalLegend)
lri.Height += LegendRenderer.EntrySpacing * (lri.Entries.Length - 1);
else
lri.Width += LegendRenderer.EntrySpacing * (lri.Entries.Length - 1);
foreach (LegendEntryRendererInfo leri in lri.Entries)
leri.MarkerArea = maxMarkerArea;
}
示例3: Draw
/// <summary>
/// Draws all charts inside the ChartFrame.
/// </summary>
public void Draw(XGraphics gfx)
{
// Draw frame of ChartFrame. First shadow frame.
int dx = 5;
int dy = 5;
gfx.DrawRoundedRectangle(XBrushes.Gainsboro,
this.location.X + dx, this.location.Y + dy,
this.size.Width, this.size.Height, 20, 20);
XRect chartRect = new XRect(this.location.X, this.location.Y, this.size.Width, this.size.Height);
XLinearGradientBrush brush = new XLinearGradientBrush(chartRect, XColor.FromArgb(0xFFD0DEEF), XColors.White,
XLinearGradientMode.Vertical);
XPen penBorder = new XPen(XColors.SteelBlue, 2.5);
gfx.DrawRoundedRectangle(penBorder, brush,
this.location.X, this.location.Y, this.size.Width, this.size.Height,
15, 15);
XGraphicsState state = gfx.Save();
gfx.TranslateTransform(this.location.X, this.location.Y);
// Calculate rectangle for all charts. Y-Position will be moved for each chart.
int charts = this.chartList.Count;
uint dxChart = 20;
uint dyChart = 20;
uint dyBetweenCharts = 30;
XRect rect = new XRect(dxChart, dyChart,
this.size.Width - 2 * dxChart,
(this.size.Height - (charts - 1) * dyBetweenCharts - 2 * dyChart) / charts);
// draw each chart in list
foreach (Chart chart in this.chartList)
{
RendererParameters parms = new RendererParameters(gfx, rect);
parms.DrawingItem = chart;
ChartRenderer renderer = GetChartRenderer(chart, parms);
renderer.Init();
renderer.Format();
renderer.Draw();
rect.Y += rect.Height + dyBetweenCharts;
}
gfx.Restore(state);
// // Calculate rectangle for all charts. Y-Position will be moved for each chart.
// int charts = this.chartList.Count;
// uint dxChart = 0;
// uint dyChart = 0;
// uint dyBetweenCharts = 0;
// XRect rect = new XRect(dxChart, dyChart,
// this.size.Width - 2 * dxChart,
// (this.size.Height - (charts - 1) * dyBetweenCharts - 2 * dyChart) / charts);
//
// // draw each chart in list
// foreach (Chart chart in this.chartList)
// {
// RendererParameters parms = new RendererParameters(gfx, rect);
// parms.DrawingItem = chart;
//
// ChartRenderer renderer = GetChartRenderer(chart, parms);
// renderer.Init();
// renderer.Format();
// renderer.Draw();
//
// rect.Y += rect.Height + dyBetweenCharts;
// }
}
示例4: PieLegendRenderer
/// <summary>
/// Initializes a new instance of the PieLegendRenderer class with the specified renderer
/// parameters.
/// </summary>
internal PieLegendRenderer(RendererParameters parms)
: base(parms)
{ }
示例5: Format
/// <summary>
/// Calculates the space used for the Y axis.
/// </summary>
internal override void Format()
{
AxisRendererInfo yari = ((ChartRendererInfo)this.rendererParms.RendererInfo).yAxisRendererInfo;
if (yari.axis != null)
{
XGraphics gfx = this.rendererParms.Graphics;
XSize size = new XSize(0, 0);
// height of all ticklabels
double yMin = yari.MinimumScale;
double yMax = yari.MaximumScale;
double yMajorTick = yari.MajorTick;
double lineHeight = Double.MinValue;
XSize labelSize = new XSize(0, 0);
for (double y = yMin; y <= yMax; y += yMajorTick)
{
string str = y.ToString(yari.TickLabelsFormat);
labelSize = gfx.MeasureString(str, yari.TickLabelsFont);
size.Width += labelSize.Width;
size.Height = Math.Max(labelSize.Height, size.Height);
lineHeight = Math.Max(lineHeight, labelSize.Width);
}
// add space for tickmarks
size.Height += yari.MajorTickMarkWidth * 1.5;
// Measure axis title
XSize titleSize = new XSize(0, 0);
if (yari.axisTitleRendererInfo != null)
{
RendererParameters parms = new RendererParameters();
parms.Graphics = gfx;
parms.RendererInfo = yari;
AxisTitleRenderer atr = new AxisTitleRenderer(parms);
atr.Format();
titleSize.Height = yari.axisTitleRendererInfo.Height;
titleSize.Width = yari.axisTitleRendererInfo.Width;
}
yari.Height = size.Height + titleSize.Height;
yari.Width = Math.Max(size.Width, titleSize.Width);
yari.InnerRect = yari.Rect;
yari.LabelSize = labelSize;
}
}
示例6: Draw
/// <summary>
/// Draws the vertical Y axis.
/// </summary>
internal override void Draw()
{
AxisRendererInfo yari = ((ChartRendererInfo)this.rendererParms.RendererInfo).yAxisRendererInfo;
double yMin = yari.MinimumScale;
double yMax = yari.MaximumScale;
double yMajorTick = yari.MajorTick;
double yMinorTick = yari.MinorTick;
XMatrix matrix = new XMatrix(); //XMatrix.Identity;
matrix.TranslatePrepend(-yMin, -yari.Y);
matrix.Scale(yari.InnerRect.Width / (yMax - yMin), 1, XMatrixOrder.Append);
matrix.Translate(yari.X, yari.Y, XMatrixOrder.Append);
// Draw axis.
// First draw tick marks, second draw axis.
double majorTickMarkStart = 0, majorTickMarkEnd = 0,
minorTickMarkStart = 0, minorTickMarkEnd = 0;
GetTickMarkPos(yari, ref majorTickMarkStart, ref majorTickMarkEnd, ref minorTickMarkStart, ref minorTickMarkEnd);
XGraphics gfx = this.rendererParms.Graphics;
LineFormatRenderer lineFormatRenderer = new LineFormatRenderer(gfx, yari.LineFormat);
XPoint[] points = new XPoint[2];
if (yari.MinorTickMark != TickMarkType.None)
{
for (double y = yMin + yMinorTick; y < yMax; y += yMinorTick)
{
points[0].X = y;
points[0].Y = minorTickMarkStart;
points[1].X = y;
points[1].Y = minorTickMarkEnd;
matrix.TransformPoints(points);
lineFormatRenderer.DrawLine(points[0], points[1]);
}
}
XStringFormat xsf = new XStringFormat();
xsf.LineAlignment = XLineAlignment.Near;
int countTickLabels = (int)((yMax - yMin) / yMajorTick) + 1;
for (int i = 0; i < countTickLabels; ++i)
{
double y = yMin + yMajorTick * i;
string str = y.ToString(yari.TickLabelsFormat);
XSize labelSize = gfx.MeasureString(str, yari.TickLabelsFont);
if (yari.MajorTickMark != TickMarkType.None)
{
labelSize.Height += 1.5f * yari.MajorTickMarkWidth;
points[0].X = y;
points[0].Y = majorTickMarkStart;
points[1].X = y;
points[1].Y = majorTickMarkEnd;
matrix.TransformPoints(points);
lineFormatRenderer.DrawLine(points[0], points[1]);
}
XPoint[] layoutText = new XPoint[1];
layoutText[0].X = y;
layoutText[0].Y = yari.Y + 1.5 * yari.MajorTickMarkWidth;
matrix.TransformPoints(layoutText);
layoutText[0].X -= labelSize.Width / 2; // Center text vertically.
gfx.DrawString(str, yari.TickLabelsFont, yari.TickLabelsBrush, layoutText[0], xsf);
}
if (yari.LineFormat != null)
{
points[0].X = yMin;
points[0].Y = yari.Y;
points[1].X = yMax;
points[1].Y = yari.Y;
matrix.TransformPoints(points);
if (yari.MajorTickMark != TickMarkType.None)
{
// yMax is at the upper side of the axis
points[0].X -= yari.LineFormat.Width / 2;
points[1].X += yari.LineFormat.Width / 2;
}
lineFormatRenderer.DrawLine(points[0], points[1]);
}
// Draw axis title
if (yari.axisTitleRendererInfo != null)
{
RendererParameters parms = new RendererParameters();
parms.Graphics = gfx;
parms.RendererInfo = yari;
XRect rcTitle = yari.Rect;
rcTitle.Height = yari.axisTitleRendererInfo.Height;
rcTitle.Y += yari.Rect.Height - rcTitle.Height;
yari.axisTitleRendererInfo.Rect = rcTitle;
AxisTitleRenderer atr = new AxisTitleRenderer(parms);
atr.Draw();
}
}
示例7: ColumnLikeChartRenderer
/// <summary>
/// Initializes a new instance of the ColumnLikeChartRenderer class with the
/// specified renderer parameters.
/// </summary>
internal ColumnLikeChartRenderer(RendererParameters parms)
: base(parms)
{
}
示例8: BarPlotAreaRenderer
/// <summary>
/// Initializes a new instance of the BarPlotAreaRenderer class with the
/// specified renderer parameters.
/// </summary>
internal BarPlotAreaRenderer(RendererParameters parms) : base(parms)
{
}
示例9: Draw
//.........这里部分代码省略.........
XMatrix matrix = XMatrix.Identity;
matrix.TranslatePrepend(-yari.InnerRect.X, yMax);
matrix.Scale(1, yari.InnerRect.Height / (yMax - yMin), XMatrixOrder.Append);
matrix.ScalePrepend(1, -1); // mirror horizontal
matrix.Translate(yari.InnerRect.X, yari.InnerRect.Y, XMatrixOrder.Append);
// Draw axis.
// First draw tick marks, second draw axis.
double majorTickMarkStart = 0, majorTickMarkEnd = 0,
minorTickMarkStart = 0, minorTickMarkEnd = 0;
GetTickMarkPos(yari, ref majorTickMarkStart, ref majorTickMarkEnd, ref minorTickMarkStart, ref minorTickMarkEnd);
XGraphics gfx = this.rendererParms.Graphics;
LineFormatRenderer lineFormatRenderer = new LineFormatRenderer(gfx, yari.LineFormat);
LineFormatRenderer minorTickMarkLineFormat = new LineFormatRenderer(gfx, yari.MinorTickMarkLineFormat);
LineFormatRenderer majorTickMarkLineFormat = new LineFormatRenderer(gfx, yari.MajorTickMarkLineFormat);
XPoint[] points = new XPoint[2];
// Draw minor tick marks.
if (yari.MinorTickMark != TickMarkType.None)
{
for (double y = yMin + yMinorTick; y < yMax; y += yMinorTick)
{
points[0].X = minorTickMarkStart;
points[0].Y = y;
points[1].X = minorTickMarkEnd;
points[1].Y = y;
matrix.TransformPoints(points);
minorTickMarkLineFormat.DrawLine(points[0], points[1]);
}
}
double lineSpace = yari.TickLabelsFont.GetHeight(gfx);
int cellSpace = yari.TickLabelsFont.FontFamily.GetLineSpacing(yari.TickLabelsFont.Style);
double xHeight = yari.TickLabelsFont.Metrics.XHeight;
XSize labelSize = new XSize(0, 0);
labelSize.Height = lineSpace * xHeight / cellSpace;
int countTickLabels = (int)((yMax - yMin) / yMajorTick) + 1;
for (int i = 0; i < countTickLabels; ++i)
{
double y = yMin + yMajorTick * i;
string str = y.ToString(yari.TickLabelsFormat);
labelSize.Width = gfx.MeasureString(str, yari.TickLabelsFont).Width;
// Draw major tick marks.
if (yari.MajorTickMark != TickMarkType.None)
{
labelSize.Width += yari.MajorTickMarkWidth * 1.5;
points[0].X = majorTickMarkStart;
points[0].Y = y;
points[1].X = majorTickMarkEnd;
points[1].Y = y;
matrix.TransformPoints(points);
majorTickMarkLineFormat.DrawLine(points[0], points[1]);
}
else
labelSize.Width += SpaceBetweenLabelAndTickmark;
// Draw label text.
XPoint[] layoutText = new XPoint[1];
layoutText[0].X = yari.InnerRect.X + yari.InnerRect.Width - labelSize.Width;
layoutText[0].Y = y;
matrix.TransformPoints(layoutText);
layoutText[0].Y += labelSize.Height / 2; // Center text vertically.
gfx.DrawString(str, yari.TickLabelsFont, yari.TickLabelsBrush, layoutText[0]);
}
// Draw axis.
if (yari.LineFormat != null && yari.LineFormat.Width > 0)
{
points[0].X = yari.InnerRect.X + yari.InnerRect.Width;
points[0].Y = yMin;
points[1].X = yari.InnerRect.X + yari.InnerRect.Width;
points[1].Y = yMax;
matrix.TransformPoints(points);
if (yari.MajorTickMark != TickMarkType.None)
{
// yMax is at the upper side of the axis
points[1].Y -= yari.LineFormat.Width / 2;
points[0].Y += yari.LineFormat.Width / 2;
}
lineFormatRenderer.DrawLine(points[0], points[1]);
}
// Draw axis title
if (yari.axisTitleRendererInfo != null && yari.axisTitleRendererInfo.AxisTitleText != "")
{
RendererParameters parms = new RendererParameters();
parms.Graphics = gfx;
parms.RendererInfo = yari;
double width = yari.axisTitleRendererInfo.Width;
yari.axisTitleRendererInfo.Rect = yari.InnerRect;
yari.axisTitleRendererInfo.Width = width;
AxisTitleRenderer atr = new AxisTitleRenderer(parms);
atr.Draw();
}
}
示例10: BarClusteredLegendRenderer
/// <summary>
/// Initializes a new instance of the BarClusteredLegendRenderer class with the
/// specified renderer parameters.
/// </summary>
internal BarClusteredLegendRenderer(RendererParameters parms)
: base(parms)
{
}
示例11: ColumnLikePlotAreaRenderer
/// <summary>
/// Initializes a new instance of the ColumnLikePlotAreaRenderer class with the
/// specified renderer parameters.
/// </summary>
internal ColumnLikePlotAreaRenderer(RendererParameters parms)
: base(parms)
{
}
示例12: LegendEntryRenderer
/// <summary>
/// Initializes a new instance of the LegendEntryRenderer class with the specified renderer
/// parameters.
/// </summary>
internal LegendEntryRenderer(RendererParameters parms)
: base(parms)
{ }
示例13: AxisTitleRenderer
/// <summary>
/// Initializes a new instance of the AxisTitleRenderer class with the
/// specified renderer parameters.
/// </summary>
internal AxisTitleRenderer(RendererParameters parms)
: base(parms)
{ }
示例14: PieExplodedPlotAreaRenderer
/// <summary>
/// Initializes a new instance of the PieExplodedPlotAreaRenderer class
/// with the specified renderer parameters.
/// </summary>
internal PieExplodedPlotAreaRenderer(RendererParameters parms)
: base(parms)
{ }
示例15: PieClosedPlotAreaRenderer
/// <summary>
/// Initializes a new instance of the PiePlotAreaRenderer class
/// with the specified renderer parameters.
/// </summary>
internal PieClosedPlotAreaRenderer(RendererParameters parms)
: base(parms)
{ }