Hi all,
I'm having some problem with the ultraChart
in my application.
I want get the StockDate from CandleDataPoint in DataItemOver Event, Here is the code:
Private Sub UChart_DataItemOver(sender As Object, e As ChartDataEventArgs) Handles UChart.DataItemOver Dim a As Object = UChart.Data Dim Item As Appearance.CandleDataPoint = e.Primitive.DataPoint
Dim tipInfo As New UltraToolTipInfo(String.Format("StockOpen:{1}{0}StockClose:{2}{0}StockHigh:{3}{0}StockLow:{4}", vbCrLf, Item.Open, Item.Close, Item.High, Item.Low), Infragistics.Win.ToolTipImage.Info, Format(e.RowLabel, "yyyy-MM-dd HH:mm"), Infragistics.Win.DefaultableBoolean.True) UltraToolTipManager1.SetUltraToolTip(UChart, tipInfo) UltraToolTipManager1.ShowToolTip(UChart) End Sub
In this Event,The CandleDataPoint .Date is sysdate and not StockDate,The e.RowLabel looks all right but just a text string(12/29 Mon 0:45:00),How can I get a format text ,like "yyyy-MM-dd HH:mm".
Thank you so much for your help in advance.
Hello,
RowLabel is a string so it must be converted to a DateTime before Format() will know how to interpret it. Taking a quick look at your code, I believe the simplest solution would be to perform a DateTime.Parse() on e.RowLabel, and pass that into the Format() call.
Format(DateTime.Parse(e.RowLabel), "yyyy-MM-dd HH:mm"),
Hopefully this helps. Let me know if you have any further questions.
Chris
Hello Chris,
Thank for your reply.
I cannot parse the real datetime from RowLabel, the text of the e.RowLabel not include any year number ,return value like as '1/12 monday 13:30' .
I try to setup the format string of RowLabel in ultraChart but I am no idea.
I'm finding it odd that the RowLabel is returned in that format. What does the date column in your datasource look like?
You could specify the RowLabels using the SetRowLabels() method off of the Data property. I used the following code right after assigning my datasource:
Dim rowLabels As New List(Of String) For Each row As DataRow In table.Rows rowLabels.Add(Format(row("StockDate"), "yyyy-MM-dd HH:mm")) Next
Me.ultraChart1.Data.SetRowLabels(rowLabels.ToArray())