User (Legacy) Posted May 21, 2002 Report Share Posted May 21, 2002 Hello, I'm new to cfxie, and am testing it in a VB6 COM object I'm developing. My target is to produce image (jpeg) charts with annotations and tooltips, so I would export both the chart and an imagemap from my COM object (which encapsulates cfxie). I am reading the docs and samples, but have very little time so... just hope somebody can help me going faster . I have to generate a simple chart with dates on the X axis, and stockclose values on the Y (very simple "financial" chart, see attachment). I extract data from an SQL database, and then populate the chart with ADOResult: SELECT STOCKCLOSE, STOCKVOLUME, STOCKDATE FROM mytable chart.DataType(0) = CDT_VALUE chart.DataType(1) = CDT_VALUE chart.DataType(2) = CDT_KEYLEGEND chart.AdoResultset RD where RD is my ADODB.Recordset populated with the above query. The chart almost looks like the way I want (see attachment), but I cannot manage to add annotations where I want. After populating the chart, I tried using the following code, found on the docs, but am not able to see my annotations where they should appear. I tried tracing the x and y values coming out from ValueToPixel, and noticed the x does not change while y does. More over, y values for the second series (stockvolume) are negative, while those for first series (stockclose) are positive. I cannot get the point, do I miss something when I generate the chart/series? Do these values really bug me, or is it something else? Set AnnotX = CreateObject("AnnotationX.AnnList") chart.AddExtension AnnotX Dim r As AnnArrow Set r = AnnotX.Add(OBJECT_TYPE_ARROW) Dim nMarkerPosition As Long Dim x As Long, y As Long For i = 0 To (chart.NSeries - 1) For j = 0 To (chart.NValues - 1) If (chart.ValueEx(i, j) > 1.4) Then chart.ValueToPixel i, j, x, y, AXIS_X r.Left = x r.Top = y r.Width = 0 r.Height = -10 r.BkColor = RGB(255, 255, 0) r.AllowMove = False r.AllowModify = False r.Refresh False End If Next j Next i I even tried a different way, always from the docs, but again I don't see annotations where I expect them to be. Set AnnotX = CreateObject("AnnotationX.AnnList") chart.AddExtension AnnotX ' For i = 0 To (chart.NSeries - 1) For j = 0 To (chart.NValues - 1) If chart.ValueEx(i, j) > 1.4 Then Set r = AnnotX.Add(3) var1 = CStr(j + 1) & ":" & chart.ValueEx(i, j) r.Attach 1, CStr(var1) r.Width = -20 r.Height = -50 r.BkColor = RGB(255, 255, 0) r.BorderWidth = 2 r.TailStyle = 1 r.HeadStyle = 0 End If Next Next Finally, I even tried populating the chart with OpenDataEx, putting in recordset values one at a time, but still I miss something about the position for annotations. Or something with series population? For example, my chart should not show volume (stockvolume) values, but only dates and stockclose values (adn it does, see attachment, even if I don't know exactly why). Well, my chart displays the same, no matter if I include or exclude "stockvolume" from the select statement: why? Thanks for any hint, code sample, idea. AL. Link to comment Share on other sites More sharing options...
Software FX Posted July 22, 2002 Report Share Posted July 22, 2002 Hello, 1) Make sure that you are passing the data to ChartFX first and then creating your annotation objects. 2) I am not sure what you are explaining with the stock volume. Is it related to the annotation or is this a second issue? JT Tech. Support 561-392-2023 "AL" <alberto.velo@softpeople.ihnet.it> wrote in message news:wZ6O7LPACHA.1088@webserver1.softwarefx.com... > Hello, > I'm new to cfxie, and am testing it in a VB6 COM object I'm developing. My > target is to produce image (jpeg) charts with annotations and tooltips, so I > would export both the chart and an imagemap from my COM object (which > encapsulates cfxie). > I am reading the docs and samples, but have very little time so... just hope > somebody can help me going faster . > > I have to generate a simple chart with dates on the X axis, and stockclose > values on the Y (very simple "financial" chart, see attachment). I extract > data from an SQL database, and then populate the chart with ADOResult: > > SELECT STOCKCLOSE, STOCKVOLUME, STOCKDATE FROM mytable > > chart.DataType(0) = CDT_VALUE > chart.DataType(1) = CDT_VALUE > chart.DataType(2) = CDT_KEYLEGEND > chart.AdoResultset RD > > where RD is my ADODB.Recordset populated with the above query. > > The chart almost looks like the way I want (see attachment), but I cannot > manage to add annotations where I want. > After populating the chart, I tried using the following code, found on the > docs, but am not able to see my annotations where they should appear. > I tried tracing the x and y values coming out from ValueToPixel, and noticed > the x does not change while y does. More over, y values for the second > series (stockvolume) are negative, while those for first series (stockclose) > are positive. > I cannot get the point, do I miss something when I generate the > chart/series? Do these values really bug me, or is it something else? > > Set AnnotX = CreateObject("AnnotationX.AnnList") > chart.AddExtension AnnotX > Dim r As AnnArrow > Set r = AnnotX.Add(OBJECT_TYPE_ARROW) > Dim nMarkerPosition As Long > Dim x As Long, y As Long > For i = 0 To (chart.NSeries - 1) > For j = 0 To (chart.NValues - 1) > If (chart.ValueEx(i, j) > 1.4) Then > chart.ValueToPixel i, j, x, y, AXIS_X > r.Left = x > r.Top = y > r.Width = 0 > r.Height = -10 > r.BkColor = RGB(255, 255, 0) > r.AllowMove = False > r.AllowModify = False > r.Refresh False > End If > Next j > Next i > > I even tried a different way, always from the docs, but again I don't see > annotations where I expect them to be. > > Set AnnotX = CreateObject("AnnotationX.AnnList") > chart.AddExtension AnnotX > ' > For i = 0 To (chart.NSeries - 1) > For j = 0 To (chart.NValues - 1) > > If chart.ValueEx(i, j) > 1.4 Then > > Set r = AnnotX.Add(3) > var1 = CStr(j + 1) & ":" & chart.ValueEx(i, j) > r.Attach 1, CStr(var1) > > r.Width = -20 > r.Height = -50 > r.BkColor = RGB(255, 255, 0) > r.BorderWidth = 2 > r.TailStyle = 1 > r.HeadStyle = 0 > End If > Next > Next > > Finally, I even tried populating the chart with OpenDataEx, putting in > recordset values one at a time, but still I miss something about the > position for annotations. Or something with series population? > For example, my chart should not show volume (stockvolume) values, but only > dates and stockclose values (adn it does, see attachment, even if I don't > know exactly why). Well, my chart displays the same, no matter if I include > or exclude "stockvolume" from the select statement: why? > > Thanks for any hint, code sample, idea. > AL. > > > > Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.