I use FillSceneGraph to display a number of types on the graph. For example if a Y axis value is below some limit i draw a Ellipse around the symbol. I also draw lines and text with no issue EXCEPT for a single Text object that i draw at the bottom left corner of the graph that contains the date and time the graph was generated.
All good so far.
When i print the graph all objects display and print in the correct position EXCEPT this Text ofject that ends up being drawn in the middle of the graph.
code:
targetLabel = New Infragistics.UltraChart.Core.Primitives.Text()
targetLabel.SetTextString(labelText)
targetLabelSize = Size.Ceiling(Infragistics.UltraChart.Core.Util.Platform.GetLabelSizePixels(targetLabel.GetTextString(), targetLabel.labelStyle))
targetLabel.bounds = New Rectangle(5, UltraChart1.Height - targetLabelSize.Height - 5, targetLabelSize.Width, targetLabelSize.Height)
e.SceneGraph.Add(targetLabel)
If you are talking about a standard .NET Label control, that would work only it won't print using
Private Sub tpPrintPreview_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tpPrintPreview.Click
Me.UltraPrintPreviewDialog1.Document = Me.UltraChart1.PrintDocument
If Me.UltraPrintPreviewDialog1.ShowDialog() = DialogResult.OK Then
Me.UltraPrintPreviewDialog1.Document.Print()
End If
End Sub
--------------------------------------------------------
Did you try your code above with the Print Preview or just Print. In my case the Text Primitive gets moved.
i am basically do whay you show about only in VB. See code below.
Within the FillSceneGraph event handler i have:
End
Pat,
You could simply place a label over the chart in that lower left-hand corner and display the information that way, but if you really want to do this in the FillSceneGraph event you could do something like this:
private void Form1_Load(object sender, EventArgs e)
{
UltraChart chart = new UltraChart();
chart.Dock = DockStyle.Fill;
chart.ChartType = ChartType.Composite;
ChartArea area = new ChartArea();
chart.CompositeChart.ChartAreas.Add(area);
AxisItem x = new AxisItem(chart, AxisNumber.X_Axis);
x.DataType = AxisDataType.String;
x.SetLabelAxisType = Infragistics.UltraChart.Core.Layers.SetLabelAxisType.GroupBySeries;
AxisItem y = new AxisItem(chart, AxisNumber.Y_Axis);
y.DataType = AxisDataType.Numeric;
area.Axes.Add(x);
area.Axes.Add(y);
NumericSeries series = new NumericSeries();
series.Points.Add(new NumericDataPoint(1, "", false));
series.Points.Add(new NumericDataPoint(2, "", false));
series.Points.Add(new NumericDataPoint(3, "", false));
chart.Series.Add(series);
ChartLayerAppearance layer = new ChartLayerAppearance();
layer.ChartArea = area;
layer.AxisX = x;
layer.AxisY = y;
layer.ChartType = ChartType.ColumnChart;
layer.Series.Add(series);
chart.CompositeChart.ChartLayers.Add(layer);
Controls.Add(chart);
chart.FillSceneGraph += (o, args) =>
Text label = new Text();
label.SetTextString("custom label");
Size labelSize = Size.Ceiling(Platform.GetLabelSizePixels(label.GetTextString(), label.labelStyle));
label.bounds = new Rectangle(5, chart.Height - labelSize.Height - 5, labelSize.Width, labelSize.Height);
args.SceneGraph.Add(label);
};
}
You will need a reference to the UltraWinChart and the following "using" statements:
using Infragistics.UltraChart;
using Infragistics.UltraChart.Core.Layers;
using Infragistics.UltraChart.Resources.Appearance;
using Infragistics.UltraChart.Shared;
using Infragistics.UltraChart.Shared.Styles;
using Infragistics.Win;
using Infragistics.Win.UltraWinChart;
using Infragistics.UltraChart.Core.Primitives;
using Infragistics.UltraChart.Core.Util;
Try that and let me know how it goes.
Not yet. even switching to an Annotation has its drawbacks. Seems like the anchor point for an Annotation is centerred vertically and horizontally.
i just want to add text in the bottom left corner that has the date and time and some text.
Is there an easier way?
Thanks
pat
Composite.
Have you been able to straighten this out?