Jump to content
Software FX Community

Help! 5.5.14.4 breaks PaintInfo much worse than 5.5.14.0


User (Legacy)

Recommended Posts

From: "Daniel Bowen" <dbowen@take-this-out-timertrac-and-this-too.com>

Subject: Help! 5.5.14.4 breaks PaintInfo much worse than 5.5.14.0

Date: Sat, 29 Jan 2005 13:42:42 -0700

Lines: 404

X-Priority: 3

X-MSMail-Priority: Normal

X-Newsreader: Microsoft Outlook Express 6.00.2900.2527

X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527

X-RFC2646: Format=Flowed; Original

Message-ID: <EiQF8LkBFHA.1140@webserver3.softwarefx.com>

Newsgroups: chartfx.internet.55

Path: webserver3.softwarefx.com

Xref: webserver3.softwarefx.com chartfx.internet.55:1962

NNTP-Posting-Host: dbowen.dsl.xmission.com 199.104.125.195

I reported earlier about getting the error

error '800a01fb'

An exception occurred: 'PaintInfo'

occasionally when calling PaintInfo in an ASP page, like so:

Set oTradeMarker = oAnnotation.Add(OBJECT_TYPE_CIRCLE)

nMarkerPosition = oChart.PaintInfo(CPI_MARKERTOPIXEL, CHART_ML(nIndex,

aTradeMarkers(nIndex)(i) )) oTradeMarker.Left =

CHART_LOWORD(nMarkerPosition) - 3

oTradeMarker.Top = CHART_HIWORD(nMarkerPosition) - 3

This was running 5.5.14.0. What I did for the short term was just turn on

"On Error Resume Next" for the occasions when that would happen.

I checked for updates the other day, and there was an update 5.5.14.4. So I

updated with it - and didn't backup the previous stuff. With the new

version, the exception happens EVERY TIME NOW!

So first off, I'd like to roll back to 5.5.14.0. It's probably just the COM

server part that needs to roll back. How can I do this? The next thing is,

it'd be great if this problem could get fixed. Also - there's no indication

about what's changed between 5.5.14.0 and 5.5.14.4 in the "fixed problems"

area.

I have a complete sample that demonstrates the problem. I'll copy and paste

it, and also attach the file.

Thanks!

-Daniel

<!--#include virtual="/include/adovbs.inc" -->

<!--#include virtual="/CfxInclude/CfxIe.inc" -->

<!--#include virtual="/CfxInclude/CfxIeCmds.inc" -->

<!--#include virtual="/CfxInclude/CfxIeExtra.inc" -->

<HTML>

<HEAD>

<TITLE>PaintInfo Exception with CPI_MARKERTOPIXEL</TITLE>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<meta name="vs_targetSchema"

content="http://schemas.microsoft.com/intellisense/ie5" />

</HEAD>

<BODY>

<%

Dim aDates(3)

aDates(0) = DateSerial(2005, 1, 6)

aDates(1) = DateSerial(2005, 1, 7)

aDates(2) = DateSerial(2005, 1, 10)

aDates(3) = DateSerial(2005, 1, 11)

Dim aResults(3)

aResults(0) = CDbl(0)

aResults(1) = CDbl(0.4)

aResults(2) = CDbl(0.3)

aResults(3) = CDbl(0.7)

' The "trade markers" array is an array of date indexes

Dim aTradeMarkers(1)

aTradeMarkers(0) = 1

aTradeMarkers(1) = 2

Dim i

Response.Write "<h1>Demonstration of PaintInfo problem</h1>" & vbNewLine

Response.Write "Dates:" & vbNewLine

Response.Write "<ul>" & vbNewLine

For i=0 To UBound(aDates)

Response.Write " <li>" & FormatDateTime(aDates(i), vbGeneralDate) &

"</li>" & vbNewLine

Next

Response.Write "</ul>" & vbNewLine

Response.Write "Results:" & vbNewLine

Response.Write "<ul>" & vbNewLine

For i=0 To UBound(aResults)

Response.Write " <li>" & FormatPercent(aResults(i), 2) & "</li>" &

vbNewLine

Next

Response.Write "</ul>" & vbNewLine

Response.Write "Trade Markers (date indexes):" & vbNewLine

Response.Write "<ul>" & vbNewLine

For i=0 To UBound(aTradeMarkers)

Response.Write " <li>" & aTradeMarkers(i) & "</li>" & vbNewLine

Next

Response.Write "</ul>" & vbNewLine

Const CF_HELVETICA = &H30000

Dim oChart, CfxArray

Set oChart = Server.CreateObject("ChartFX.WebServer.4")

Dim nGraphWidth, nGraphHeight

nGraphWidth = 600 : nGraphHeight = 430

With oChart

.Fonts(CHART_TOPFT) = .Fonts(CHART_TOPFT) Or CF_BOLD Or 10

.Chart3D = False

.AllowDrag = False

.AllowEdit = False

.ShowTips = True

.ImgMap = CHART_MAP_TITLETIP

.MarkerShape = MK_NONE

.AxesStyle = CAS_3DFRAME

.Grid = CHART_BOTHGRID Or CHART_GRIDY2

.RgbBK = RGB(204,204,153) ' Tan

.BottomGap = 20

.TopGap = 20

.Gallery = LINES

.LineWidth = 2

End With

Set CfxArray = Server.CreateObject("CfxData.Array")

CfxArray.UseLastArrayItem = True

' First add the X value arrays

CfxArray.AddArray aDates

oChart.DataType(0) = CDT_XVALUE

' Then add the Y value arrays.

' The DataType array uses 1..n for x axis, and n+1...m for y axis values

' (where 1 is the x-axis for the y-axis of n+1).

CfxArray.AddArray aResults

oChart.DataType(1) = CDT_VALUE

oChart.GetExternalData CfxArray

With oChart.Axis(AXIS_X)

dtFirstDate = CDate(.Min)

dtLastDate = CDate(.Max)

.GridColor = RGB(230,230,230) ' Off white

.Font.Name = "Verdana"

.Font.Size = 7

.Font.Bold = False

End With

With oChart.Series(0)

.YAxis = AXIS_Y

.Legend = "Results"

End With

With oChart.Axis(AXIS_Y2)

.Min = oChart.Axis(AXIS_Y).Min

.Max = oChart.Axis(AXIS_Y).Max

.Style = .Style And Not (AS_HIDE Or AS_HIDETEXT)

.GridColor = RGB(230,230,230) ' Off white

.Font.Name = "Verdana"

.Font.Size = 7

.Font.Bold = False

.Format = AF_PERCENTAGE

.Decimals = 1

End With

With oChart.Axis(AXIS_Y)

.Style = .Style Or (AS_HIDE Or AS_HIDETEXT)

.GridColor = RGB(230,230,230) ' Off white

.Font.Name = "Verdana"

.Font.Size = 7

.Font.Bold = False

' Have a decimal place for the tool tip (the labels are Y2, but the

series are Y1)

.Format = AF_PERCENTAGE

.Decimals = 3

End With

' Have a constant horizontal for the "zero" line (starting point)

oChart.OpenDataEx COD_CONSTANTS,1,0

' "Zero" line

With oChart.ConstantLine(0)

.LineStyle = CHART_SOLID

.LineWidth = 1

.LineColor = RGB(160,160,160) ' Gray

.Axis = AXIS_Y2

.Value = nGrowthStart

End With

oChart.CloseData COD_CONSTANTS

' Set the color of the series

oChart.OpenDataEx COD_COLORS,oChart.Series.Count,0

oChart.Series(0).Color = RGB(0,0,0)

oChart.CloseData COD_COLORS

' Other client side UI

oChart.Toolbar = True

oChart.ToolbarObj.Visible = True

oChart.ToolbarObj.Docked = TGFP_TOP

With oChart.Commands(CFX_ID_GALLERY)

.RemoveAllSubCommands

.SubCommandID(0) = CFX_ID_LINE

.SubCommandID(1) = CFX_ID_CURVE

.SubCommandID(2) = CFX_ID_CURVEAREA

.SubCommandID(3) = CFX_ID_AREA

.SubCommandID(4) = CFX_ID_STEP

.SubCommandID(5) = CFX_ID_SURFACE

.SubCommandID(6) = CFX_ID_CUBE

.SubCommandID(7) = CFX_ID_BUBBLE

.SubCommandID(8) = CFX_ID_SCATTER

End With

oChart.SerLegBox = True

oChart.SerLegBoxObj.Visible = True

oChart.SerLegBoxObj.Docked = TGFP_TOP

oChart.Axis(AXIS_X).Format = "XMMM d, yyyy "

oChart.LeftGap = 40

Dim oAnnotation

Set oAnnotation = Server.CreateObject("AnnotationX.AnnList")

oChart.AddExtension oAnnotation

oAnnotation.Toolbar = False

oAnnotation.ToolbarObj.Visible = False

Const TA_LEFT = &H0&

Const TA_CENTER = &H1&

Const TA_RIGHT = &H2&

Const TA_TOP = &H0&

Const TA_VERTICALCENTER = &H4&

Const TA_BOTTOM = &H8&

Const TA_WORDBREAK = &H10&

Dim nMarkerPosition, oTradeMarker

' To see the graph, but with the "markers" in the wrong place

' (because of the PaintInfo problem), uncomment the following line:

'On Error Resume Next

For i=0 To UBound(aTradeMarkers)

Set oTradeMarker = oAnnotation.Add(OBJECT_TYPE_CIRCLE)

nMarkerPosition = oChart.PaintInfo(CPI_MARKERTOPIXEL, CHART_ML(0,

aTradeMarkers(i) ))

oTradeMarker.Left = CHART_LOWORD(nMarkerPosition) - 3

oTradeMarker.Top = CHART_HIWORD(nMarkerPosition) - 3

oTradeMarker.BorderWidth = 2

oTradeMarker.Color = RGB(255,0,0)

oTradeMarker.Width = 6

oTradeMarker.Height = 6

oTradeMarker.BkColor = RGB(255,255,102)

'oTradeMarker.URL = "javascript:showTradeMarkerDetails(0," & i & ");"

oTradeMarker.AllowMove = False

oTradeMarker.AllowModify = False

Next

Response.Write oChart.GetHtmlTag(nGraphWidth,nGraphHeight)

%>

</BODY>

</HTML>

Link to comment
Share on other sites

Check that the index you are passing is indeed within range (both series and 

point).

Please debug and check what values are being passed when the crash occurs.

If the values seem correct, please export the chart to a binary file and let

us know which values passed to PaintInfo are causing the crash.

One more thing. Have you tried attaching the annotation object instead of

using MarkerToPixel, this is the recommended way to place an annotation

object at a logical position.

--

FP

Software FX

Link to comment
Share on other sites

Thanks for replying.

> Check that the index you are passing is indeed within range (both series

> and point).

Yes, in fact, I was fortunately able to get to a backup of version 5.5.14.0

of CfxIESrv.dll, and the ASP sample I posted worked just fine (but fails

with 5.5.14.4). The program doesn't crash the web server, but returns a

failed HRESULT, causing VBScript to stop in its tracks (unless On Error

Resume Next is in effect). I suspect that PaintInfo has a try/catch block

in it though, and that either an access violation or the like is happening,

and the catch just returns a failed HRESULT (0x800a01fb). I haven't

attached a native debugger to it yet to step through the disassembly to see

for sure what's happening.

> Please debug and check what values are being passed when the crash occurs.

> If the values seem correct, please export the chart to a binary file and

> let us know which values passed to PaintInfo are causing the crash.

No chart is rendered, unless I suppress failed HRESULTs via "On Error Goto

0", in which case, the variable remains uninitialized, and is coerced to 0

(resulting in 0,0 as the logical placement). The sample I provided

reproduces the problem every time for me on version 5.5.14.4 of

CfxIESrv.dll, and works perfectly for 5.5.14.0. Please try it out.

> One more thing. Have you tried attaching the annotation object instead of

> using MarkerToPixel, this is the recommended way to place an annotation

> object at a logical position.

The problem that I ran into with "Attach" is that the chart I'm using is an

X/Y chart where the X-axis is a date/time. Using the sample I provided

(which uses date/time for the X-axis), could you please tell me how to

change it to use Attach properly? Also, as a future enhancement, it would

be nice if the "AttachPosition" argument took a safe array, so that you

could do something like this:

Call Attach(ATTACH_CENTER, Array(dtDateTimeX, nPercentageY))

(You wouldn't even have to change the interface to support this, since the

second argument takes a VARIANT*).

Thanks,

-Daniel

Link to comment
Share on other sites

> Yes, in fact, I was fortunately able to get to a backup of version 

> 5.5.14.0 of CfxIESrv.dll, and the ASP sample ...

The fact that it works in 5.5.14 does not necessarily mean that the bug was

introduced in the new version. If you had a buffer overflow, the error may

just not show up in this version simply because of how the stack is

arranged. Debugging which values are being passed to this method when the

crash occurs is essential to finding a solution to this problem.

> No chart is rendered, unless I suppress failed HRESULTs via "On Error Goto

> 0", in which case, the variable remains uninitialized

What I meant was Export the chart BEFORE calling PaintInfo and LOG the

values passed, when you get the chart, go to the LOG, see which one cause

the error and then retrieve the file that was Exported right before that

happened. Attach the file along with the values being passed.

> The problem that I ran into with "Attach" is that the chart I'm using is

> an X/Y chart where the X-axis is a date/time.

All dates are converted to doubles in order for Chart FX to manipulate them.

You can ask Chart FX for an specify X-Value and it will return you the

corresponding double. For example:

xValue = chart.XValue(nIndex, aTradeMarkers(nIndex)(i))

--

FP

Software FX

Link to comment
Share on other sites

> The fact that it works in 5.5.14 does not necessarily mean that the bug 

> was introduced in the new version. If you had a buffer overflow, the error

> may just not show up in this version simply because of how the stack is

> arranged. Debugging which values are being passed to this method when the

> crash occurs is essential to finding a solution to this problem.

> ...

> What I meant was Export the chart BEFORE calling PaintInfo and LOG the

> values passed, when you get the chart, go to the LOG, see which one cause

> the error and then retrieve the file that was Exported right before that

> happened. Attach the file along with the values being passed.

The sample I provided is a complete sample that reproduces the problem for

me on version 5.5.14.4 of CfxIESrv.dll, but works fine on 5.5.14.0. Did the

sample work for you under 5.5.14.4? I have debugged all values being

passed, and tried numerous variations of what should all be valid values.

I've tried hard-coding the values as well. The problem with 5.5.14.4

happens for every single call of PaintInfo that I try. With 5.5.14.0, all

valid values work as they should.

The problem I'm having is all from server side code in an ASP page

(VBScript) running under Windows 2000 Server / IIS 5.0. It's not from doing

anything client-side. It's the server side COM object (CfxIESrv.dll), not

the client side ActiveX control that I've tested. I could also try to see

if doing the annotation object(s) from the client side has the same problem,

but I haven't done that yet. I can also try to export the chart before

calling PaintInfo like you suggest, but I'll tell you the values that the

sample fails on:

nMarkerPosition = oChart.PaintInfo(CPI_MARKERTOPIXEL, CHART_ML(0, 0))

nMarkerPosition = oChart.PaintInfo(CPI_MARKERTOPIXEL, CHART_ML(0, 1))

nMarkerPosition = oChart.PaintInfo(CPI_MARKERTOPIXEL, CHART_ML(0, 2))

nMarkerPosition = oChart.PaintInfo(CPI_MARKERTOPIXEL, CHART_ML(0, 3))

It fails on each one individually.

If I had a spare machine facing the public internet, I'd have it setup with

5.5.14.4, and show you the error. However, I do have the sample I provided

on a machine with 5.5.14.0, and here's how its suppose to look:

http://63.172.124.102/private/research/chartBugs/PaintInfoProblem.asp

The complete code for that page is posted in the first message in this

thread.

I could change the machine temporarily to use 5.5.14.4 if you'd like to see

the problem, but I'd like to keep that time window as small as possible

(since it breaks things). You should also easily be able to see the problem

if you tried it out on a test machine of your own with 5.5.14.0 and another

one with 5.5.14.4 (you might have to change the include lines slightly). On

your own machine, you could actually debug into the PaintInfo call when its

called from the ASP page, and step through the source to see what's really

going on. I don't think that it matters its Windows 2000 Server, so you

could try it out on web site on XP or 2003 server.

> All dates are converted to doubles in order for Chart FX to manipulate

> them. You can ask Chart FX for an specify X-Value and it will return you

> the corresponding double. For example:

>

> xValue = chart.XValue(nIndex, aTradeMarkers(nIndex)(i))

Thanks!

I've tried the attach way, but the placement of the markers isn't quite as

exact as the PaintInfo way I had:

http://63.172.124.102/private/research/chartBugs/PaintInfoProblem2.asp

I suppose after the Attach, I could tweak the Top and Left.

Thanks!

-Daniel

Link to comment
Share on other sites

I should have removed that.  It's comes with ADO (classic) to define a bunch 

of constants, but the sample I gave doesn't use ADO. You can delete that

line. I've also attached an updated version of the sample without it.

Thanks!

-Daniel

"SoftwareFX Support" <noreply@softwarefx.com> wrote in message

news:Kx1$cUiCFHA.2536@webserver3.softwarefx.com...

> PS: I can not run your code, maybe because I'm missing

> "include/adovbs.inc".

> Was that includded in the lost file ?

>

> --

> FP

> Software FX

>

>

Link to comment
Share on other sites

Let me try again, this time with a .txt extension.

-Daniel

"Daniel Bowen" <dbowen@take-this-out-timertrac-and-this-too.com> wrote in

message news:Lxy$bbjCFHA.2544@webserver3.softwarefx.com...

>I should have removed that. It's comes with ADO (classic) to define a

>bunch

> of constants, but the sample I gave doesn't use ADO. You can delete that

> line. I've also attached an updated version of the sample without it.

>

> Thanks!

> -Daniel

>

> "SoftwareFX Support" <noreply@softwarefx.com> wrote in message

> news:Kx1$cUiCFHA.2536@webserver3.softwarefx.com...

>> PS: I can not run your code, maybe because I'm missing

>> "include/adovbs.inc".

>> Was that includded in the lost file ?

>>

>> --

>> FP

>> Software FX

>>

>>

>

>

>

Link to comment
Share on other sites

I got it this time.

A few things:

1) I found a bug that is affecting you and I'm uploading a new service pack

tonight.

2) Make sure the chart has a size BEFORE calling MarkerToPixel, otherwise it

will be not possible to calculate the position.

I added the following to your code, right before GetPaintInfo:

oChart.ImgWidth = nGraphWidth

oChart.ImgHeight = nGraphHeight

oChart.UpdateSizeNow()

3) Did you try the Attach method ? Again, using Attach is the recommended

way to this, if you want to generate a Client Component instead of an image

for example, the Attach method will allow the annotation object to move

along with the points as the chart is resized (e.g. printed) re-scaled, etc.

--

FP

Software FX

Link to comment
Share on other sites

> 1) I found a bug that is affecting you and I'm uploading a new service 

> pack tonight.

Thanks!

> 2) Make sure the chart has a size BEFORE calling MarkerToPixel, otherwise

> it will be not possible to calculate the position.

>

> I added the following to your code, right before GetPaintInfo:

>

> oChart.ImgWidth = nGraphWidth

> oChart.ImgHeight = nGraphHeight

> oChart.UpdateSizeNow()

Good to know. Thanks! If the documentation ever happens to get updated,

it'd be great to have this in the remarks of "PaintInfo"

(ChartFX_API.chm::/GPaintInfoMet.htm and ChartFX_API.chm::/CPIConst.htm).

> 3) Did you try the Attach method ? Again, using Attach is the recommended

> way to this, if you want to generate a Client Component instead of an

> image for example, the Attach method will allow the annotation object to

> move along with the points as the chart is resized (e.g. printed)

> re-scaled, etc.

I did try it with your suggestion on how to deal with the date/time (that

it's apparently using the underlying DATE date type that's typedef'ed to a

double, so I can just use the double value of the date). The one small

drawback is that it's placement is slightly off from what I'd expect when I

choose ATTACH_CENTER. Take a look at these, and look carefully at the

placement of the annotation objects.

MarkerToPixel:

http://63.172.124.102/private/research/chartBugs/PaintInfoProblem.asp

Attach (ATTACH_CENTER)

http://63.172.124.102/private/research/chartBugs/PaintInfoProblem2.asp

The second one uses the sample code from the first sample, but does this:

oTradeMarker.Attach ATTACH_CENTER, CDbl(aDates(aTradeMarkers(i))) & "," &

aResults(aTradeMarkers(i))

oTradeMarker.Width = 6

oTradeMarker.Height = 6

instead of

nMarkerPosition = oChart.PaintInfo(CPI_MARKERTOPIXEL, CHART_ML(0,

aTradeMarkers(i) ))

oTradeMarker.Left = CHART_LOWORD(nMarkerPosition) - 3

oTradeMarker.Top = CHART_HIWORD(nMarkerPosition) - 3

oTradeMarker.Width = 6

oTradeMarker.Height = 6

It might not seem like a big deal, but when you have several series, with

lots of annotation objects, being a few pixels off can make the graph not as

clear.

Thanks!

-Daniel

Link to comment
Share on other sites

> It might not seem like a big deal, but when you have several series, with 

> lots of annotation objects, being a few pixels off can make the graph not

> as clear.

Agree. However, the results should be the same, are you sure you are not

rounding the values before passing them to attach ? When you convert your

date to Double and later to string, make sure you preserve all the decimals.

--

FP

Software FX

Link to comment
Share on other sites

"SoftwareFX Support" <noreply@softwarefx.com> wrote in message 

news:PS0w9PHDFHA.2488@webserver3.softwarefx.com...

>> It might not seem like a big deal, but when you have several series, with

>> lots of annotation objects, being a few pixels off can make the graph not

>> as clear.

>

> Agree. However, the results should be the same, are you sure you are not

> rounding the values before passing them to attach ? When you convert your

> date to Double and later to string, make sure you preserve all the

> decimals.

Yes, all the precision is preserved. I just double checked. Here's a

screen shot to show the difference (zoomed in with Magnifier).

1st data point

http://63.172.124.102/private/research/chartBugs/PaintInfoVsAttachCenter1.gif

2nd data point

http://63.172.124.102/private/research/chartBugs/PaintInfoVsAttachCenter2.gif

The left side is exactly the sample I posted, using PaintInfo, and my own

centering (left = x - (width/2), top = y - (height/2)). The right side is

the same code as the sample, except it uses Attach with ATTACH_CENTER.

For the 1st data point, the Attach with ATTACH_CENTER is off by 2 pixels

vertically (too far down) and 1 pixel horizontally (too far to the right).

For the 2nd data point, Attach with ATTACH_CENTER is 1 pixel off vertically

(too far down), and 2 pixels off horizontally (too far to the right).

Thanks!

-Daniel

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...