problem with grid lines on logarithmic chart

TeeChart for ActiveX, COM and ASP
Post Reply
ITI
Newbie
Newbie
Posts: 8
Joined: Tue Apr 05, 2005 4:00 am

problem with grid lines on logarithmic chart

Post by ITI » Tue Jun 23, 2009 1:57 pm

I created a logarithmic chart with solid major and minor grid lines on an ASP page. For some reason, a few of the minor grid lines come out much thicker than the others, even though I have specified the pen width. What can I do to solve the issue? Is this a bug?

Here is my code for setting the chart properties. Please let me know if I need to post the full code.

Set Chart1 = CreateObject("TeeChart.TChart")

'sets Chart properties
Chart1.Aspect.View3D=False
Chart1.Header.Text(0) = ""
Chart1.Legend.LegendStyle = lsSeries

'sets Chart axes
Chart1.Axis.Left.Automatic = False
Chart1.Axis.Left.Logarithmic = True
Chart1.Axis.Left.SetMinMax 1, 3000
Chart1.Axis.Left.GridPen.Style = psSolid
Chart1.Axis.Left.GridPen.Color = RGB(153, 153, 153)
Chart1.Axis.Left.GridPen.Width = 1
Chart1.Axis.Left.MinorTickCount = 8
Chart1.Axis.Left.MinorGrid.Style = psSolid
Chart1.Axis.Left.MinorGrid.Color = RGB(153, 153, 153)
Chart1.Axis.Left.MinorGrid.Width = 1
Chart1.Axis.Left.MinorGrid.Visible = True
Chart1.Axis.Bottom.Automatic = False
Chart1.Axis.Bottom.Logarithmic = True
Chart1.Axis.Bottom.SetMinMax 0.005, 10
Chart1.Axis.Bottom.GridPen.Style = psSolid
Chart1.Axis.Bottom.GridPen.Color = RGB(153, 153, 153)
Chart1.Axis.Bottom.GridPen.Width = 1
Chart1.Axis.Bottom.MinorTickCount = 8
Chart1.Axis.Bottom.MinorGrid.Style = psSolid
Chart1.Axis.Bottom.MinorGrid.Color = RGB(153, 153, 153)
Chart1.Axis.Bottom.MinorGrid.Width = 1
Chart1.Axis.Bottom.MinorGrid.Visible = True

ITI
Newbie
Newbie
Posts: 8
Joined: Tue Apr 05, 2005 4:00 am

Re: problem with grid lines on logarithmic chart

Post by ITI » Tue Jun 23, 2009 2:01 pm

I've uploaded a screen shot showing the issue with the grid lines. The minor grid lines for 3, 4 and 7 are noticably thicker.
Attachments
pic1.jpg
pic1.jpg (99.76 KiB) Viewed 9116 times

Yeray
Site Admin
Site Admin
Posts: 9614
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: problem with grid lines on logarithmic chart

Post by Yeray » Tue Jun 23, 2009 3:14 pm

Hi ITI,

Yes, the complete example would be helpful. I've tested your code with a vb6 application and I can't reproduce the problem. Could you also tell us the exact version you are using?

Thanks in advance.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

ITI
Newbie
Newbie
Posts: 8
Joined: Tue Apr 05, 2005 4:00 am

Re: problem with grid lines on logarithmic chart

Post by ITI » Tue Jun 23, 2009 3:39 pm

I've previously made a log/log chart in VB without a problem. But right now the problem I'm having is with ASP, not VB. I'm using teechart7.ocx version 7.0.1.4, which is installed on our server.

Here is my code. There are two ASP pages - one to create the chart and save to stream, one page to display the chart.

CreateExCurve.asp

Code: Select all

<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%Option Explicit%>

<!--#include file="../TChartConsts.vbs" -->
<!--#include file="../ado1v.inc" -->
<!--#include file="../Connections/conCTTestRecords.asp" -->

<%
	Dim rstTestData
	Dim strSQLTestData
	Dim strRO
	Dim strFrequency
	Dim Chart1	
	Dim i 
	Dim iPage
		
	strRO = Request.QueryString("RO")
	
	If Request.QueryString("Page") = "" Then
		iPage = 1
	Else
		iPage = Cint(Request.QueryString("Page"))
	End If	
		
	'opens a recordset of the test data	
	strSQLTestData = "SELECT tblTestData.SerialNo, tblTestData.ExPointOhOhFive, tblTestData.ExPointOhOne, tblTestData.ExPointOhTwo, tblTestData.ExPointOhFive, tblTestData.ExPointOne, tblTestData.ExPointTwoFive, tblTestData.ExPointFive, tblTestData.ExOne, tblTestData.ExFive, tblTestData.ExTen, tblCatalog.TestFrequency FROM tblCatalog RIGHT JOIN tblTestData ON tblCatalog.CatNo = tblTestData.CatNo WHERE tblTestData.RO = '" & strRO & "' AND Fail=0 AND [CTR/TestCard]='CTR' AND CTRApproved = False"
	
	Set rstTestData = Server.CreateObject("ADODB.Recordset")
	
	'sets the number of records to be displayed on a page
	rstTestData.PageSize = 10
	
	rstTestData.Open strSQLTestData, MM_conCTTestRecords_STRING, adOpenKeySet, _
 	 adLockReadOnly, adCmdText
	 
	'gets the test frequency for the catalog number
	If rstTestData.EOF = False Then
		strFrequency = rstTestData("TestFrequency").Value
	End If	

  	Response.Buffer=true
  	Set Chart1 = CreateObject("TeeChart.TChart")
  
    'sets Chart properties
    Chart1.Aspect.View3D=False
	Chart1.Header.Text(0) = ""
	Chart1.Legend.LegendStyle = lsSeries
	
	'sets Chart axes	
	Chart1.Axis.Left.Automatic = False
	Chart1.Axis.Left.Logarithmic = True
	Chart1.Axis.Left.SetMinMax 1, 3000
	Chart1.Axis.Left.GridPen.Style = psSolid
	Chart1.Axis.Left.GridPen.Color = RGB(153, 153, 153)
	Chart1.Axis.Left.GridPen.Width = 1
	Chart1.Axis.Left.MinorTickCount = 8
	Chart1.Axis.Left.MinorGrid.Style = psSolid	
	Chart1.Axis.Left.MinorGrid.Color = RGB(153, 153, 153)
	Chart1.Axis.Left.MinorGrid.Width = 1
	Chart1.Axis.Left.MinorGrid.Visible = True
	Chart1.Axis.Left.Title.Caption = "Secondary Exciting Voltage, " & strFrequency & "Hz."	
	Chart1.Axis.Bottom.Automatic = False
	Chart1.Axis.Bottom.Logarithmic = True
	Chart1.Axis.Bottom.SetMinMax 0.005, 10
	Chart1.Axis.Bottom.GridPen.Style = psSolid
	Chart1.Axis.Bottom.GridPen.Color = RGB(153, 153, 153)
	Chart1.Axis.Bottom.GridPen.Width = 1
	Chart1.Axis.Bottom.MinorTickCount = 8
	Chart1.Axis.Bottom.MinorGrid.Style = psSolid
	Chart1.Axis.Bottom.MinorGrid.Color = RGB(153, 153, 153)
	Chart1.Axis.Bottom.MinorGrid.Width = 1
	Chart1.Axis.Bottom.MinorGrid.Visible = True	
	Chart1.Axis.Bottom.Title.Caption = "Secondary Exciting Amps, " & strFrequency & "Hz."	
	
	'sets the current page
	rstTestData.AbsolutePage = ipage
	
	'loops through the recordset and plots data points on chart
	If rstTestData.EOF = False Then
		i = 0
		Do While Not (rstTestData.EOF OR rstTestData.AbsolutePage <> iPage)
			Chart1.AddSeries(scLine)
			Chart1.Series(i).Pen.Width = 2	
			If IsNull(rstTestData("ExPointOhOhFive").Value) Then
				Chart1.Series(i).AddNullXY 0, 0, ""
			Else
				Chart1.Series(i).AddXY 0.005, rstTestData("ExPointOhOhFive").Value, "", clTeeColor	
			End If
			
			If IsNull(rstTestData("ExPointOhOne").Value) Then
				Chart1.Series(i).AddNullXY 0, 0, ""
			Else
				Chart1.Series(i).AddXY 0.01, rstTestData("ExPointOhOne").Value, "", clTeeColor
			End If
			
			If IsNull(rstTestData("ExPointOhTwo").Value) Then
				Chart1.Series(i).AddNullXY 0, 0, ""
			Else
				Chart1.Series(i).AddXY 0.02, rstTestData("ExPointOhTwo").Value, "", clTeeColor
			End If
			
			If IsNull(rstTestData("ExPointOhFive").Value) Then
				Chart1.Series(i).AddNullXY 0, 0, ""
			Else
				Chart1.Series(i).AddXY 0.05, rstTestData("ExPointOhFive").Value, "", clTeeColor
			End If
			
			If IsNull(rstTestData("ExPointOne").Value) Then
				Chart1.Series(i).AddNullXY 0, 0, ""
			Else
				Chart1.Series(i).AddXY 0.1, rstTestData("ExPointOne").Value, "", clTeeColor
			End If
			
			If IsNull(rstTestData("ExPointTwoFive").Value) Then
				Chart1.Series(i).AddNullXY 0, 0, ""
			Else
				Chart1.Series(i).AddXY 0.25, rstTestData("ExPointTwoFive").Value, "", clTeeColor
			End If
			
			If IsNull(rstTestData("ExPointFive").Value) Then
				Chart1.Series(i).AddNullXY 0, 0, ""
			Else
				Chart1.Series(i).AddXY 0.5, rstTestData("ExPointFive").Value, "", clTeeColor
			End If
			
			If IsNull(rstTestData("ExOne").Value) Then
				Chart1.Series(i).AddNullXY 0, 0, ""
			Else
				Chart1.Series(i).AddXY 1, rstTestData("ExOne").Value, "", clTeeColor
			End If
			
			If IsNull(rstTestData("ExFive").Value) Then
				Chart1.Series(i).AddNullXY 0, 0, ""
			Else
				Chart1.Series(i).AddXY 5, rstTestData("ExFive").Value, "", clTeeColor
			End If
			
			If IsNull(rstTestData("ExTen").Value) Then
				Chart1.Series(i).AddNullXY 0, 0, ""
			Else
				Chart1.Series(i).AddXY 10, rstTestData("ExTen").Value, "", clTeeColor
			End If
			
			Chart1.Series(i).Title = rstTestData("SerialNo").Value
			
			i = i + 1
			rstTestData.MoveNext
		Loop
	End If
	
	rstTestData.Close
	Set rstTestData = Nothing

  	Response.BinaryWrite (Chart1.Export.asNative.SaveToStream(True))
%>
DisplayExCurve.asp

Code: Select all

<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%Option Explicit%>

<!--#include file="../TChartConsts.vbs" -->
<!--#include file="../ado1v.inc" -->
<!--#include file="../Connections/conCTTestRecords.asp" -->

<%
Dim ServerPath
If Request.Servervariables("LOCAL_ADDR")="127.0.0.1" Then
      ServerPath="localhost"
Else
      ServerPath=Request.Servervariables("LOCAL_ADDR")
End If
%>

<%	
	'opens a recordset to get the page count, which is needed to create the navigation links
	Dim rst
	Dim strSQL
	Dim strRO
	Dim iPage
	Dim iPageCount
	Dim i
	
	strRO = Request.QueryString("RO")
		
	strSQL = "SELECT tblTestData.SerialNo FROM tblTestData WHERE tblTestData.RO = '" & strRO & "' AND Fail=0 AND [CTR/TestCard]='CTR' AND CTRApproved = False"
	
	Set rst = Server.CreateObject("ADODB.Recordset")
	rst.PageSize = 10
	rst.Open strSQL, MM_conCTTestRecords_STRING, adOpenKeySet, adLockReadOnly, adCmdText	

	If rst.EOF = True Then
		iPageCount = 0
	Else
		iPageCount = rst.PageCount
	End If
	
	'sets the page number to load
	If Request.QueryString("Page") = "" Then
		iPage = 1
	Else
		iPage = Cint(Request.QueryString("Page"))
	End If
%>

<html>
<META HTTP-EQUIV="Expires" CONTENT="0">

<script language="VBScript">

Sub Window_onLoad() 
	TChart2.Import.LoadFromURL("http://<%=ServerPath%>:8080/CTTestRecords/CreateExCurve.asp?RO=<%=strRO%>&Page=<%=iPage%>")
End Sub

Sub TChart2_OnAfterDraw()
End Sub

</script>
<head>
<title>Excitation Curves for RO <%=strRO%></title>
<link href="../ITIStyles.css" rel="stylesheet" type="text/css" />
</head>
<body>
<p>
Page <%=iPage%> of <%=iPageCount%></p>
<p>

<object 
   id="TChart2" 
   width="550" 
   height="450" 
   type="application/x-oleobject" 
   hspace="0"
   vspace="0" 
   classid="CLSID:FAB9B41C-87D6-474D-AB7E-F07D78F2422E"
   CODEBASE="http://clwflfs01cige:8080/teechart7.cab#Version=7,0,0,0">
</object>

</p>
<p>
<%
'creates the navigation links if there is more than 1 page
If iPageCount > 1 Then
	If iPage > 1 Then
%>
		<a href="DisplayExCurve.asp?RO=<%=strRO%>&Page=<%=iPage - 1%>">[<<]</a>
<%
	End If

	For i = 1 To iPageCount
		If i = iPage Then
%>
			<%= i %>
<%
		Else
%>
			<a href="DisplayExCurve.asp?RO=<%=strRO%>&Page=<%= i %>"><%= i %></a>
<%
		End If
	Next 

	If iPage < iPageCount Then
%>
  		<a href="DisplayExCurve.asp?RO=<%=strRO%>&Page=<%=iPage + 1%>">[>>]</a>
<%
	End If
End If
%>
</p>
</body>
</html>

<%
	rst.Close
	Set rst = Nothing
%>


Yeray
Site Admin
Site Admin
Posts: 9614
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: problem with grid lines on logarithmic chart

Post by Yeray » Thu Jun 25, 2009 10:00 am

Hi ITI,

Thanks for the code but I've seen some includes and select calls that we can't do here. So it would be helpful if you could arrange a simple example we can run as-is here to reproduce the problem here.

Thanks in advance.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

ITI
Newbie
Newbie
Posts: 8
Joined: Tue Apr 05, 2005 4:00 am

Re: problem with grid lines on logarithmic chart

Post by ITI » Thu Jun 25, 2009 3:54 pm

Well, you did say to post the "complete" code. :)

Here is a stripped down version. I've removed all the include files (except for the TeeChart constants file) and recordset references. After a lot of testing, I think the problem occurs when I add series inside a loop. I've attached a screen capture of chart. As you can see, the lines for 2, 3, 4, 5, 6 and 9 are thicker.

CreateLogChart.asp

Code: Select all

<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%Option Explicit%>

<!--#include file="../TChartConsts.vbs" -->

<%
	Dim Chart1	
	Dim i 
		
  	Response.Buffer=true
  	Set Chart1 = CreateObject("TeeChart.TChart")
  
    'sets Chart properties
    Chart1.Aspect.View3D=False
	Chart1.Header.Text(0) = ""
	Chart1.Legend.LegendStyle = lsSeries
	
	'sets Chart axes	
	Chart1.Axis.Left.Automatic = False
	Chart1.Axis.Left.Logarithmic = True
	Chart1.Axis.Left.SetMinMax 1, 3000
	Chart1.Axis.Left.GridPen.Style = psSolid
	Chart1.Axis.Left.GridPen.Color = RGB(153, 153, 153)
	Chart1.Axis.Left.GridPen.Width = 1
	Chart1.Axis.Left.MinorTickCount = 8
	Chart1.Axis.Left.MinorGrid.Style = psSolid	
	Chart1.Axis.Left.MinorGrid.Color = RGB(153, 153, 153)
	Chart1.Axis.Left.MinorGrid.Width = 1
	Chart1.Axis.Left.MinorGrid.Visible = True
	Chart1.Axis.Left.Title.Caption = "Secondary Exciting Voltage"	
	Chart1.Axis.Bottom.Automatic = False
	Chart1.Axis.Bottom.Logarithmic = True
	Chart1.Axis.Bottom.SetMinMax 0.005, 10
	Chart1.Axis.Bottom.GridPen.Style = psSolid
	Chart1.Axis.Bottom.GridPen.Color = RGB(153, 153, 153)
	Chart1.Axis.Bottom.GridPen.Width = 1
	Chart1.Axis.Bottom.MinorTickCount = 8
	Chart1.Axis.Bottom.MinorGrid.Style = psSolid
	Chart1.Axis.Bottom.MinorGrid.Color = RGB(153, 153, 153)
	Chart1.Axis.Bottom.MinorGrid.Width = 1
	Chart1.Axis.Bottom.MinorGrid.Visible = True	
	Chart1.Axis.Bottom.Title.Caption = "Secondary Exciting Amps"	

		For i = 0 to 10
			Chart1.AddSeries(scLine)
			Chart1.Series(i).Pen.Width = 2	
			
			Chart1.Series(i).AddXY 0.01, i+2, "", clTeeColor
			Chart1.Series(i).AddXY 0.02, i+2, "", clTeeColor
			Chart1.Series(i).AddXY 0.05, i+2, "", clTeeColor
			Chart1.Series(i).AddXY 0.1, i+2, "", clTeeColor
			Chart1.Series(i).AddXY 0.25, i+2, "", clTeeColor
			Chart1.Series(i).AddXY 0.5, i+2, "", clTeeColor
			Chart1.Series(i).AddXY 1, i+2, "", clTeeColor
			Chart1.Series(i).AddXY 5, i+2, "", clTeeColor
			Chart1.Series(i).AddXY 10, i+2, "", clTeeColor
		Next
			
  	Response.BinaryWrite (Chart1.Export.asNative.SaveToStream(True))
%>

DisplayLogChart.asp

Code: Select all

<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%Option Explicit%>

<!--#include file="../TChartConsts.vbs" -->

<%
Dim ServerPath
If Request.Servervariables("LOCAL_ADDR")="127.0.0.1" Then
      ServerPath="localhost"
Else
      ServerPath=Request.Servervariables("LOCAL_ADDR")
End If
%>

<html>
<META HTTP-EQUIV="Expires" CONTENT="0">

<script language="VBScript">

Sub Window_onLoad() 
	TChart2.Import.LoadFromURL("http://<%=ServerPath%>:8080/CTTestRecords/CreateLogChart.asp")
End Sub

Sub TChart2_OnAfterDraw()
End Sub

</script>
<head>
<title>Logarithmic Chart Example</title>
</head>
<body>

<p>

<object 
   id="TChart2" 
   width="550" 
   height="450" 
   type="application/x-oleobject" 
   hspace="0"
   vspace="0" 
   classid="CLSID:FAB9B41C-87D6-474D-AB7E-F07D78F2422E"
   CODEBASE="http://clwflfs01cige:8080/teechart7.cab#Version=7,0,0,0">
</object>

</p>
</body>
</html>

Attachments
pic1.jpg
pic1.jpg (117.72 KiB) Viewed 9063 times

Yeray
Site Admin
Site Admin
Posts: 9614
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: problem with grid lines on logarithmic chart

Post by Yeray » Fri Jun 26, 2009 8:46 am

Hi ITI,

Thank you for the code! Yes you are right, I could reproduce it in v7 and I want you to know that I've tested the same code with v8 and couldn't reproduce it, so it seems to be solved from v8.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

ITI
Newbie
Newbie
Posts: 8
Joined: Tue Apr 05, 2005 4:00 am

Re: problem with grid lines on logarithmic chart

Post by ITI » Fri Jun 26, 2009 1:54 pm

Thanks for checking into it. I guess we will just have to live with it for now.

Post Reply