Page 1 of 1

How to set the backwall color?

Posted: Mon Nov 12, 2012 10:36 am
by 16663707
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

Re: How to set the backwall color?

Posted: Mon Nov 12, 2012 4:24 pm
by 10050769
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,

Re: How to set the backwall color?

Posted: Tue Nov 13, 2012 8:29 am
by 16663707
Hi Sandra.

That worked fine. Thanks.

Re: How to set the backwall color?

Posted: Tue Nov 13, 2012 8:55 am
by 16663707
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

Re: How to set the backwall color?

Posted: Wed Nov 14, 2012 8:30 am
by yeray
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

Re: How to set the backwall color?

Posted: Wed Nov 14, 2012 8:44 am
by 16663707
Thanks - that worked great. Think I''ll need to spend time looking at the tutorials....

Re: How to set the backwall color?

Posted: Wed Nov 14, 2012 9:39 am
by yeray
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.