2d Line Series Outline Color

TeeChart for ActiveX, COM and ASP
Post Reply
AndrewK
Newbie
Newbie
Posts: 8
Joined: Fri Nov 15, 2002 12:00 am
Contact:

2d Line Series Outline Color

Post by AndrewK » Fri Jan 07, 2005 11:18 pm

I can't get the outline color to work using a 2d line chart with Steema 5.

Here is the code I'm using:

m_oTChart.Series(i).asLine.outline.visible = true
m_oTChart.Series(i).asLine.outline.width = 1
m_oTChart.Series(i).asLine.outline.color = vbBlack

The outline shows up and with the proper width but it shows up only with the color used for m_oTChart.Series(i).Color

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Mon Jan 10, 2005 8:50 am

Hi AndrewK,

Which TeeChart version are you using? Your code works here using latest releases of v5, v6 and v7 ActiveX.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

AndrewK
Newbie
Newbie
Posts: 8
Joined: Fri Nov 15, 2002 12:00 am
Contact:

Post by AndrewK » Mon Jan 10, 2005 3:26 pm

We're using v5 in ASP pages.

Also, the outline color works when the chart is 3D, but not when it is 2D.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Tue Jan 11, 2005 10:54 am

Hi AndrewK,

Here it works ok using maintenance release v5.06, are you using this version? If not you can download it from our Customer Download Area.

If it is still not working could you please send us an example that we can run "as-is" to reproduce the problem here? You can send the example to our steema.public.attachments newsgroup.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

AndrewK
Newbie
Newbie
Posts: 8
Joined: Fri Nov 15, 2002 12:00 am
Contact:

Post by AndrewK » Thu Jan 13, 2005 2:12 am

I can't extract and provide a working set of code very easily. But, here is some additional info which I hope is helpful:

If I populate the line series with the FillSampleValues method the outline works (oChart.Series(i).FillSampleValues 10).

If I populate the line series with the Add method I encounter the problems I've mentioned above (oChart.Series(i).Add).

AndrewK
Newbie
Newbie
Posts: 8
Joined: Fri Nov 15, 2002 12:00 am
Contact:

Post by AndrewK » Fri Jan 14, 2005 1:44 am

I can't find the attachment newsgroup anywhere.

Here is an example which demonstrates the problem I'm having. Please let me know what I should be doing instead.

AndrewK
Newbie
Newbie
Posts: 8
Joined: Fri Nov 15, 2002 12:00 am
Contact:

Post by AndrewK » Fri Jan 14, 2005 1:46 am

<!--METADATA NAME="TeeChart Pro v5 ActiveX Control" TYPE="TypeLib" UUID="{B6C10482-FB89-11D4-93C9-006008A7EED4}"-->
<%
dim i, j

dim strParams
strParams = "arealine1:750:230:right:-1:-1:-1:3::Business Labor ():#,##0."

dim strLabels
strLabels = "Jan 2005:Feb 2005:Mar 2005:Apr 2005:May 2005:Jun 2005:Jul 2005:Aug 2005:" & _
"Sep 2005:Oct 2005:Nov 2005:Dec 2005:Jan 2006:Feb 2006:Mar 2006:Apr 2006:May 2006:" & _
"Jun 2006:Jul 2006:Aug 2006:Sep 2006:Oct 2006:Nov 2006:Dec 2006:Jan 2007:Feb 2007:" & _
"Mar 2007:Apr 2007:May 2007:Jun 2007:Jul 2007:Aug 2007:Sep 2007:Oct 2007:Nov 2007:" & _
"Dec 2007:Jan 2008:Feb 2008:Mar 2008:Apr 2008:May 2008:Jun 2008:Jul 2008:Aug 2008:" & _
"Sep 2008:Oct 2008:Nov 2008:Dec 2008:Jan 2009:Feb 2009:Mar 2009:Apr 2009:May 2009:" & _
"Jun 2009:Jul 2009:Aug 2009:Sep 2009:Oct 2009:Nov 2009:Dec 2009"


dim strSeries
strSeries = "scArea,Baseline|880,Blue:2008,Blue:3449,Blue:4873,Blue:6442,Blue:7703,Blue:" & _
"9797,Blue:10318,Blue:10838,Blue:11359,Blue:11879,Blue:12142,Blue:12142,Blue:12142,Blue:" & _
"12142,Blue:12142,Blue:12142,Blue:12142,Blue:12142,Blue:12142,Blue:12142,Blue:12142,Blue:" & _
"12142,Blue:12142,Blue:12142,Blue:12142,Blue:12142,Blue:12142,Blue:12142,Blue:12142,Blue:" & _
"12142,Blue:12142,Blue:12142,Blue:12142,Blue:12142,Blue:12142,Blue:12142,Blue:12142,Blue:" & _
"12142,Blue:12142,Blue:12142,Blue:12142,Blue:12142,Blue:12142,Blue:12142,Blue:12142,Blue:" & _
"12142,Blue:12142,Blue:12142,Blue:12142,Blue:12142,Blue:12142,Blue:12142,Blue:12142,Blue:" & _
"12142,Blue:12142,Blue:12142,Blue:12142,Blue:12142,Blue:12142,Blue!scLine,Committed|880,Red:" & _
"2008,Red:3449,Red:4873,Red:6442,Red:7703,Red:7703,Red:0,Red:0,Red:0,Red:0,Red:0,Red:0,Red:" & _
"0,Red:0,Red:0,Red:0,Red:0,Red:0,Red:0,Red:0,Red:0,Red:0,Red:0,Red:0,Red:0,Red:0,Red:0,Red:" & _
"0,Red:0,Red:0,Red:0,Red:0,Red:0,Red:0,Red:0,Red:0,Red:0,Red:0,Red:0,Red:0,Red:0,Red:0,Red:" & _
"0,Red:0,Red:0,Red:0,Red:0,Red:0,Red:0,Red:0,Red:0,Red:0,Red:0,Red:0,Red:0,Red:0,Red:0,Red:" & _
"0,Red:0,Red!scLine,Accepted|0,vbGreen:0,vbGreen:0,Green:0,Green:0,Green:0,Green:7703,Green:7703,Green:" & _
"7703,Green:7703,Green:7703,Green:7703,Green:7703,Green:7703,Green:7703,Green:7703,Green:7703,Green:" & _
"7703,Green:7703,Green:7703,Green:7703,Green:7703,Green:7703,Green:7703,Green:7703,Green:7703,Green:" & _
"7703,Green:7703,Green:7703,Green:7703,Green:7703,Green:7703,Green:7703,Green:7703,Green:7703,Green:" & _
"7703,Green:7703,Green:7703,Green:7703,Green:7703,Green:7703,Green:7703,Green:7703,Green:7703,Green:" & _
"7703,Green:7703,Green:7703,Green:7703,Green:7703,Green:7703,Green:7703,Green:7703,Green:7703,Green:" & _
"7703,Green:7703,Green:7703,Green:7703,Green:7703,Green:7703,Green:7703,Green"

dim arrParams: arrParams = split(strParams,":")
dim arrLabels: arrLabels = split(strLabels,":")
dim arrSeries: arrSeries = split(strSeries,"!")

dim strChartType: strChartType = arrParams(0)
dim intChartWidth: intChartWidth = arrParams(1)
dim intChartHeight: intChartHeight = arrParams(2)
dim strLegendPosition: strLegendPosition = arrParams(3)
dim fUseCustomColors: fUseCustomColors = cbool(arrParams(4))
dim fXAutoScale: fXAutoScale = cbool(arrParams(5))
dim fYAutoScale: fYAutoScale = cbool(arrParams(6))
dim intLineCount: intLineCount = arrParams(7)
dim strXAxisLabel: strXAxisLabel = arrParams(8)
dim strYAxisLabel: strYAxisLabel = arrParams(9)
dim strXFormat: strXFormat = arrParams(10)

dim oChart: set oChart = CreateObject("TeeChart.TChart.5")
oChart.Aspect.view3d = false
'oChart.Axis.Left.GridPen.Visible = false
'oChart.Axis.Bottom.GridPen.Visible = false
oChart.Axis.Bottom.Labels.Angle = 45
oChart.Axis.Bottom.Labels.Font.Bold = true
oChart.Axis.Bottom.Labels.Font.Size = 9
oChart.Axis.Left.Labels.Font.Size = 9

if len(strXAxisLabel) > 0 then
oChart.Axis.Bottom.Title.Caption = strXAxisLabel
oChart.Axis.Left.Title.Font.Size = 10
oChart.Axis.Left.Title.Font.Bold = true
end if

if len(strYAxisLabel) > 0 then
oChart.Axis.Left.Title.Caption = strYAxisLabel
oChart.Axis.Left.Title.Font.Size = 10
oChart.Axis.Left.Title.Font.Bold = true
end if

if len(strXFormat) > 0 then
oChart.Axis.Left.Labels.ValueFormat = strXFormat
end if

oChart.Height = intChartHeight
oChart.Width = intChartWidth
oChart.Panel.Color = vbWhite
oChart.Panel.BorderStyle = 0
oChart.Panel.BevelOffset = 0
oChart.Header.Visible = false





if lcase(strLegendPosition) = "right" then
oChart.Legend.Alignment = laRight
else
oChart.Legend.Alignment = laBottom
end if

dim arrSeriesParams
dim arrTempSeries
dim arrSeriesData
dim arrSeriesDataPoints

for i = 0 to intLineCount -1
arrTempSeries = split(arrSeries(i),"|")
arrSeriesParams = split(arrTempSeries(0),",")
arrSeriesData = split(arrTempSeries(1),":")
oChart.AddSeries(eval(arrSeriesParams(0)))
oChart.Series(i).Title = arrSeriesParams(1)
'oChart.Series(i).FillSampleValues 10

for j = 0 to ubound(arrSeriesData)
arrSeriesDataPoints = split(arrSeriesData(j), ",")
if arrSeriesDataPoints(0) <> "" then
oChart.Series(i).Add CDbl(arrSeriesDataPoints(0)), arrLabels(j), GetCustomColor(arrSeriesDataPoints(1))
' if arrSeriesParams(0) = "scLine" then
' oChart.series(i).asLine.outline.visible = true
' oChart.series(i).asLine.outline.color = vbBlack
' end if
end if


next




oChart.series(i).Color = GetCustomColor(arrSeriesDataPoints(1))


next


Response.ContentType = "image/PNG"
Response.BinaryWrite (oChart.Export.asPNG.SaveToStream)
Response.Flush

set oChart = nothing




Function GetCustomColor(strInput)
dim Output
select case lcase(strInput)
case "blue": Output = HSV2RGB(240,157,179)
case "green": Output = HSV2RGB(120,155,153)
case "purple": Output = RGB(153,51,204)
case "yellow": Output = HSV2RGB(40,155,153)
case "red": Output = HSV2RGB(0,185,218)
case "orange": Output = HSV2RGB(30,192,243)
case "gray": Output = RGB(153,153,153)
case "aqua": Output = HSV2RGB(210,153,128)
case "cyan": Output = HSV2RGB(180,153,128)
case "teal": Output = HSV2RGB(145,153,128)
case "gold": Output = HSV2RGB(50,255,191)
case "violet": Output = HSV2RGB(320,153,128)
case "rose": Output = HSV2RGB(0,255,191)
case "olive": Output = HSV2RGB(80,153,128)
case "maroon": Output = HSV2RGB(0,153,128)
case "peach": Output = HSV2RGB(19,153,128)
case "brown": Output = HSV2RGB(40,153,128)
case "drab": Output = HSV2RGB(61,153,128)
case "lightgreen": Output = RGB(204, 255, 204)
case else: Output = RGB(255,255,255)

end select
GetCustomColor = Output
End Function

Function HSV2RGB( iHue, iSat, iVol ) '0..360, 0..360, 0..360 --> Color(R,G,B)
Dim H,S,V
H=iHue-360.0*Int(CDbl(iHue)/360.0)
S=Cdbl(iSat)-255.0*Int(CDbl(iSat)/360.0)
V=Cdbl(iVol)-255.0*Int(CDbl(iVol)/360.0)

H=CDbl(H)/60.0
S=CDbl(S)/255.0

Dim I : I=Abs(Fix(H))
Dim F : F=Abs(H-I)
Dim M : M=Abs(V*(1-S))
Dim N : N=Abs(V*(1-S*F))
Dim K : K=Abs(V*(1-S*(1-F)))

Select Case I
Case 1 : HSV2RGB = RGB(N,V,M)
Case 2 : HSV2RGB = RGB(M,V,K)
Case 3 : HSV2RGB = RGB(M,N,V)
Case 4 : HSV2RGB = RGB(K,M,V)
Case 5 : HSV2RGB = RGB(V,M,N)
Case else : HSV2RGB = RGB(V,K,M)
End Select

End Function
%>

Pep
Site Admin
Site Admin
Posts: 3273
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Fri Jan 21, 2005 11:01 am

Hi Andrew,

I see what happens here, to make it work you must set the Color of the series in the following manner, instead of setting a color for each point you add :

Code: Select all

for j = 0 to ubound(arrSeriesData) 
arrSeriesDataPoints = split(arrSeriesData(j), ",") 
if arrSeriesDataPoints(0) <> "" then 
oChart.Series(i).Add CDbl(arrSeriesDataPoints(0)), arrLabels(j), clTeecolor 
oChart.Series(i).Color=GetCustomColor(arrSeriesDataPoints(1))
 if arrSeriesParams(0) = "scLine" then 
 oChart.series(i).asLine.outline.visible = true 
 oChart.series(i).asLine.outline.color = vbBlack 
 end if 
end if 

Post Reply