How to set the backwall color?

TeeChart for ActiveX, COM and ASP
Post Reply
Keith
Newbie
Newbie
Posts: 4
Joined: Tue Oct 16, 2012 12:00 am

How to set the backwall color?

Post by Keith » Mon Nov 12, 2012 10:36 am

I've taken the example code, and am playing with the chart. I want to set the background color of the chart to white.

I've commented out the 'gradient' part, but can't see how to change the panel background color. I get an error (even though this is in the help files in the installation):


Microsoft VBScript runtime error '800a01b6'

Object doesn't support this property or method: 'Panel.BackWallColor'


Obviously missing something silly here!!!!


Thanks.

Set Chart1 = CreateObject("TeeChart.TChart")

'=== Extract Chart type =======
ChartType = 1
ViewType = 0

'=== Add Series ==========
Chart1.AddSeries(1)
Chart1.AddSeries(1)
Chart1.AddSeries(1)

'=== Setup Chart view =====
Chart1.Aspect.View3D=0

'=== Do Chart bits and pieces =====
Chart1.Header.Text(0)="TeeChart Series Types"
chart1.walls.visible=true
' Chart1.Walls.Left.Transparent=True
' Chart1.Walls.Left.Color=RGB(35,70,128)
' Chart1.Panel.Gradient.Visible=True
' Chart1.Panel.Gradient.StartColor=&HB3DEF5 '&H8CB4D2
' Chart1.Panel.Gradient.EndColor=&HFACE87

Chart1.Panel.BackWallColor = RGB(255,255,255)

'==== Size will be used for image output formats =====
Chart1.Width = 450
Chart1.Height = 290

'=== use your methods eg via DB to populate Chart or...
' Chart1.Series(0).FillSampleValues 20
with chart1
.Series(1).asBar.StackGroup = 0
.Series(1).asBar.MultiBar = mbStacked
.Series(0).Marks.Visible = false
.Series(1).Marks.Visible = false
.Series(2).Marks.Visible = false

.Legend.Visible=True
.Legend.LegendStyle=3
.Legend.TextStyle=2
.Legend.Alignment=1

.Series(0).add cDbl(objRS("wsBudgetTotal")), "Budget", rgb(0,0,255)
.Series(1).add cDbl(objRS("wsOrderIntakeTotal")), "Actual", rgb(0,255,0)
.Series(2).add cDbl(objRS("wsVarianceTotal")), "Variance", rgb(255,0,0)

.Series(0).asBar.StackGroup = 0
.Series(1).asBar.StackGroup = 1
.Series(2).asBar.StackGroup = 1

end with

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: How to set the backwall color?

Post by Sandra » Mon Nov 12, 2012 4:24 pm

Hello Keith,

You only need change the color of panel as I do using next code:

Code: Select all

TChart1.Panel.Gradient.Visible = False
TChart1.Panel.Color = RGB(255, 255, 255)
Could you please tell us if previous code works in your end?

I hope will helps.

Thanks,
Best Regards,
Sandra Pazos / 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

Keith
Newbie
Newbie
Posts: 4
Joined: Tue Oct 16, 2012 12:00 am

Re: How to set the backwall color?

Post by Keith » Tue Nov 13, 2012 8:29 am

Hi Sandra.

That worked fine. Thanks.

Keith
Newbie
Newbie
Posts: 4
Joined: Tue Oct 16, 2012 12:00 am

Re: How to set the backwall color?

Post by Keith » Tue Nov 13, 2012 8:55 am

I have a second issue on the same chart. The 'actual' series value (which is being set as rgb(0,255,0) ) is showing as Green in the chart itself, but in the Legend, it's an amber/orange color.

Any ideas please?

Full code below - thanks.


Response.ContentType = "image/png"

Dim ChartType
Dim OutputStream
Dim ViewType

'=== Create Chart ======
Set Chart1 = CreateObject("TeeChart.TChart")

'=== Extract Chart type =======
ChartType = 1
ViewType = 0

'=== Add Series ==========
Chart1.AddSeries(1)
Chart1.AddSeries(1)
Chart1.AddSeries(1)

'=== Setup Chart view =====
Chart1.Aspect.View3D=0

'=== Do Chart bits and pieces =====
Chart1.Header.Text(0)="KPI Order Intake v Budget"
chart1.walls.visible=true

Chart1.Panel.Gradient.Visible = False
Chart1.Panel.Color = RGB(255, 255, 255)

'==== Size will be used for image output formats =====
Chart1.Width = 450
Chart1.Height = 450

'=== use your methods eg via DB to populate Chart or...
with chart1
.Series(1).asBar.StackGroup = 0
.Series(1).asBar.MultiBar = mbStacked
.Series(0).Marks.Visible = false
.Series(1).Marks.Visible = false
.Series(2).Marks.Visible = false

.Legend.Visible=True
.Legend.LegendStyle=3
.Legend.TextStyle=2
.Legend.Alignment=0

.Series(0).add objRS("wsBudgetTotal"), "Budget", rgb(0,0,255)
.Series(1).add objRS("wsOrderIntakeTotal"), "Actual", rgb(0,255,0)
.Series(2).add objRS("wsVarianceTotal"), "Variance", rgb(255,0,0)

.Series(0).asBar.StackGroup = 0
.Series(1).asBar.StackGroup = 1
.Series(2).asBar.StackGroup = 1

end with
'=== Set output format
OutputStream=Chart1.Export.asPNG.SaveToStream

'=== Cleanup the Chart =====
Set Chart1=Nothing
objRS.Close
Set objRS = nothing
objConn.Close
set objConn = nothing

'===Send off the finished product ====
Response.Binarywrite OutputStream

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

Re: How to set the backwall color?

Post by Yeray » Wed Nov 14, 2012 8:30 am

Hi,

Note you can ser a color to a series but also to each point in that series. And it's actually what you are doing when adding the points with value, label and color.
Since you haven't set the series' color, the colors of the default palette are taken as the series colors, and so is shown in the legend.
You can set the series' color, ie assigning the color you have in the first point of the series. And the same for the three series.

Code: Select all

  With chart1
    .Series(0).Color = .Series(0).PointColor(0)
    .Series(1).Color = .Series(1).PointColor(0)
    .Series(2).Color = .Series(2).PointColor(0)
  End With
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

Keith
Newbie
Newbie
Posts: 4
Joined: Tue Oct 16, 2012 12:00 am

Re: How to set the backwall color?

Post by Keith » Wed Nov 14, 2012 8:44 am

Thanks - that worked great. Think I''ll need to spend time looking at the tutorials....

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

Re: How to set the backwall color?

Post by Yeray » Wed Nov 14, 2012 9:39 am

Hi Keith,
Keith wrote:Thanks - that worked great.
You're welcome! I'm glad to hear it works fine! :)
Keith wrote: Think I''ll need to spend time looking at the tutorials....
Always recommended. I'd also suggest you to take a look at the features demo to see the possibilities of the component.
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

Post Reply