Dim objBoxAnnotation As New Infragistics.UltraChart.Resources.Appearance.BoxAnnotation
objBoxAnnotation.TextStyle.FontColor = Color.Black
objBoxAnnotation.TextStyle.Orientation = Infragistics.UltraChart.[Shared].Styles.TextOrientation.Horizontal
objBoxAnnotation.Location.Type = Infragistics.UltraChart.Shared.Styles.LocationType.DataValues
objBoxAnnotation.Border.Color = Color.Transparent
objBoxAnnotation.Location.ValueX = ("6/4/2008").ToOADate
objBoxAnnotation.Location.ValueY = intPositionY
objBoxAnnotation.Height = 200
objBoxAnnotation.Width = 200
In the above code i am using the location type is datavalues(datetime and numberic values) but i am not able to plot the annotation using the datavalues.
in chart i am using the X axis as axis type is time and y axis type is integer can any one help in these
Hello, I think I've found your problem and an easy solution.
Your objBoxAnnotation.Location.ValueX is set to ("6/4/2008").ToOADate() which returns the OLE Date. Instead we want to use Ticks. However we also must take into account the starting date. So in the example code below my first data point is 6/4/2008, so if I want the annotation to appear at any date, say 6/6/2008, then you'll need to subtract the Ticks of the starting date (6/4/2008) from the date you want the annotation to be displayed (6/6/2008).
If this does not solve your problem, make sure that the property TreatDateTimeAsString is set to false. Have a good day.
NumericTimeSeries testData = new NumericTimeSeries(); testData.Label = "Test Data"; testData.Points.Add(new NumericTimeDataPoint(DateTime.Parse("2008-06-04"), 10, "A", false)); testData.Points.Add(new NumericTimeDataPoint(DateTime.Parse("2008-06-05"), 13, "A", false)); testData.Points.Add(new NumericTimeDataPoint(DateTime.Parse("2008-06-06"), 18, "A", false)); testData.Points.Add(new NumericTimeDataPoint(DateTime.Parse("2008-06-07"), 15, "A", false)); ultraChart1.Series.Add(testData); ultraChart1.Data.DataBind(); BoxAnnotation boxAnnotation = new BoxAnnotation(); boxAnnotation.Text = "P1"; boxAnnotation.TextStyle.FontColor = Color.Black; boxAnnotation.TextStyle.Orientation = Infragistics.UltraChart.Shared.Styles.TextOrientation.Horizontal; boxAnnotation.Location.Type = Infragistics.UltraChart.Shared.Styles.LocationType.DataValues; boxAnnotation.Border.Color = Color.Transparent; boxAnnotation.Location.ValueX = DateTime.Parse("2008-06-06").Ticks - DateTime.Parse("2008-06-04").Ticks; boxAnnotation.Location.ValueY = 12; boxAnnotation.TextStyle.Font = new Font(FontFamily.GenericSansSerif, 10.0F, FontStyle.Bold); boxAnnotation.Height = 200; boxAnnotation.Width = 200; ultraChart1.Annotations.Add(boxAnnotation);