chChartTypeColumnStacked chart category axis labels

C

Chris Bowring

Hi,

I'm trying to replicate a graph in Excel that uses two rows for the
category (X) axis labels. There are nine cells per series and the two rows
containing the labels also have nine cells each. However, the first row
is split into three merged cells, each containing three cells.

This has the effect of dividing the chart into three sections, each with three
columns. The category axis labels show the contents of the three cells below
each of the merged cells in sections labelled with the contents of the merged
cells.

I can't really explain it better then this, so you might just have to try it
to see what I mean. My question is, can this be done with an Owc11.ChChart?

Any help much appreciated.

More info:

Data looks like this:

- Section1_____________ - Section2_____________ - Section3_____________
- Head1 - Head2 - Head3 - Head4 - Head5 - Head6 - Head7 - Head8 - Head9
- Data1 - Data2 - Data3 - Data4 - Data5 - Data6 - Data7 - Data8 - Data9

Thanks,

Chris.
 
C

Chris Bowring

Alvin,

thanks for your help on this.

I tried following the steps in your article on MSDN, but I couldn't catch the
events in my Form1. I put some code in the InitializeComponent method:

this.objChart.AfterFinalRender += new
AxMicrosoft.Office.Interop.Owc11.IChartEvents_AfterFinalRenderEventHandler
(objChart_AfterFinalRender);

and stuck a breakpoint in objChart_AfterFinalRender, but it didn't break.

I also read that this wouldn't work in a web environment. I am currently using
Owc11.ChartSpaceClass to generate images of charts that I'm using elsewhere. If
I use AxChartSpace instead, can I still use the approach you've suggested. Do
you have any idea why it may not be working for me?

Many thanks,

Chris.

Alvin Bruney said:
Yes, it can be done using custom drawing. There is an article on custom
drawing on MSDN, you can find it here
http://support.microsoft.com/default.aspx?scid=kb;en-us;555162. If that
won't do, you can find more indepth stuff in the black book.

--
Regards,
Alvin Bruney - ASP.NET MVP

[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
Now available @ www.lulu.com/owc
Chris Bowring said:
Hi,

I'm trying to replicate a graph in Excel that uses two rows for the
category (X) axis labels. There are nine cells per series and the two rows
containing the labels also have nine cells each. However, the first row
is split into three merged cells, each containing three cells.

This has the effect of dividing the chart into three sections, each with
three
columns. The category axis labels show the contents of the three cells
below
each of the merged cells in sections labelled with the contents of the
merged
cells.

I can't really explain it better then this, so you might just have to try
it
to see what I mean. My question is, can this be done with an
Owc11.ChChart?

Any help much appreciated.

More info:

Data looks like this:

- Section1_____________ - Section2_____________ - Section3_____________
- Head1 - Head2 - Head3 - Head4 - Head5 - Head6 - Head7 - Head8 - Head9
- Data1 - Data2 - Data3 - Data4 - Data5 - Data6 - Data7 - Data8 - Data9

Thanks,

Chris.
 
A

Alvin Bruney [MVP - ASP.NET]

You need to patch visual studio to allow it to respond to OWC events.
There's an article on msdn about this if you care to look.

--
Regards,
Alvin Bruney - ASP.NET MVP

[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
Now available @ www.lulu.com/owc
Chris Bowring said:
Alvin,

thanks for your help on this.

I tried following the steps in your article on MSDN, but I couldn't catch
the
events in my Form1. I put some code in the InitializeComponent method:

this.objChart.AfterFinalRender += new
AxMicrosoft.Office.Interop.Owc11.IChartEvents_AfterFinalRenderEventHandler
(objChart_AfterFinalRender);

and stuck a breakpoint in objChart_AfterFinalRender, but it didn't break.

I also read that this wouldn't work in a web environment. I am currently
using
Owc11.ChartSpaceClass to generate images of charts that I'm using
elsewhere. If
I use AxChartSpace instead, can I still use the approach you've suggested.
Do
you have any idea why it may not be working for me?

Many thanks,

Chris.

Alvin Bruney said:
Yes, it can be done using custom drawing. There is an article on custom
drawing on MSDN, you can find it here
http://support.microsoft.com/default.aspx?scid=kb;en-us;555162. If that
won't do, you can find more indepth stuff in the black book.

--
Regards,
Alvin Bruney - ASP.NET MVP

[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
Now available @ www.lulu.com/owc
Chris Bowring said:
Hi,

I'm trying to replicate a graph in Excel that uses two rows for the
category (X) axis labels. There are nine cells per series and the two
rows
containing the labels also have nine cells each. However, the first row
is split into three merged cells, each containing three cells.

This has the effect of dividing the chart into three sections, each
with
three
columns. The category axis labels show the contents of the three cells
below
each of the merged cells in sections labelled with the contents of the
merged
cells.

I can't really explain it better then this, so you might just have to
try
it
to see what I mean. My question is, can this be done with an
Owc11.ChChart?

Any help much appreciated.

More info:

Data looks like this:

- Section1_____________ - Section2_____________ - Section3_____________
- Head1 - Head2 - Head3 - Head4 - Head5 - Head6 - Head7 - Head8 - Head9
- Data1 - Data2 - Data3 - Data4 - Data5 - Data6 - Data7 - Data8 - Data9

Thanks,

Chris.
 
C

Chris Bowring

To anyone who is interested, the problem wasn't anything to do with a VS patch, it
was that the MSDN documentation omitted that you have to set the
AxChartSpace.AllowRenderEvents property to true if you want to catch these events.

Chris.
 
C

ChrisBowringGG

Does anybody know of a way to achieve this without using the
AxChartSpace?

I want to use this in a web service that can't instantiate an ActiveX
control
because the current thread is not in a single-threaded apartment.

I have been looking at ChAxis.CategoryLabels.LevelCount, which suggests
it
is possible to have hierarchical chart axes
(see
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/owcvba11/html/ocproLevelCount.asp)
but I can't find a way of adding levels?

Can anybody help?

Thanks,

Chris.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top