I want to draw a 'stacked column chart' in VB.Net in which a series data is just stacked one above the other in the same column.

Let me explain: Suppose I have three series of data each having 5 values like this:

Series 1: (a1,b1,c1,d1,e1)
Series 2: (a2,b2,c2,d2,e2)
Series 3: (a3,b3,c3,d3,e3)

At present if you draw the stacked column chart it will draw each column with in the following way:

Stacked column 1: a1,a2,a3
Stacked column 2: b1,b2,b3
Stacked column 3: c1,c2,c3
Stacked column 4: d1,d2,d3
Stacked column 5: e1,e2,e3

But what I want is to have just three stacked columns like this:

Stacked column 1: (a1,b1,c1,d1,e1)
Stacked column 2: (a2,b2,c2,d2,e2)
Stacked column 3: (a3,b3,c3,d3,e3)

That is each series point should be plotted one above the previous one.

This seems to be a simple chart - but IMHO it is not possible right now with the chart facility.

This is not a 'Grouped Stacked Column Chart' which just stacks one series value above the other and produces the columns.

I need to make this chart quite urgently.

Kindly help.

Rgds

Renga Iyengar

Recommended Answers

All 6 Replies

Take a look at your own post!

If you plot 3 series each with 5 points, you get 5 columns with 3 points in each column.

Notice the relation detween the number of points and the number of columns as well as the relation between number of series and number of points per column.

What you wanted was 3 columns with 5 points each.

So make 5 series each with 3 points.

Thanks for the reply. You are correct. Normally, if you plot 3 series with 5 points, you get 5 columns with 3 points each.ut

What I want to do is this: All the 5 points of a series to be stacked in a single column. Actually the number of series in my dataset is about 70 or even more..the no of points in each series will vary from say 3 to about 40 or so.

Hence If I have say 70 series, then I will have 70 columns with 3 stacks minimum to 40 maximum. I am trying to plot this using a VB.chart without arranging the dataset. I want the series data to be just stacked one above another.

Also I want each column to be of a single colour..which is also not possible as of now..the color is based on a series..

Hope the requirement is clear.

Renga

So you seem to understand how the chart control plots the points. Instead of relying on the so-called DataBinding supported by this control, create each series in code. You will have one series for each column in the datatable. Add a datapoint for each row in the column.

To get each chart column to be the same color, define an aray of colors. The size of the array would be the number of rows in the datatable. Then while adding each datapoint, set the DataPoint.Color property from this array based on the data source row.

Thanks for your reply. I have tried to make it by means of drawing each point code and it is ok for small charts. But this chart is what is known as 'Line Balancing chart' and it is regularly used in factories. Here each column represent a machine or a workcenter like an assembly station. Each data point usually represents the time taken for each activity done in the station.

The data for this kind of chart comes from an ERP database and literally the points are a few thousand to a few lakhs at times depending on the purpose of line balancing. Also this chart has to be totally interactive as the users has to drag the rectangles on from one column and drop on to another one for 'balancing the activities'.

I have tried this questions at a few more forums - but found that no body is able to fully understand what the chart is ! The present method of producing such a chart - by means of re-assembling each data point is long winded way of producing this chart.

Instead one can resort to drawing each rectangle by the .net drawing routines..but one has to write more routings for zooming, scaling etc - which seems to be re-inventing the wheel.

Thanks again for your reply.

Why did you not state that you are attempting to create a Yamazumi chart when you first posted?

Creating the functionality you have described can be accomplished using the chart control with some thought put into structuring the source data and a willingness to write some code. Two criteria that you have indicated that you are unwilling to accept.

Good luck.

Thanks.The yamazumi charts are just one type of the LB charts. But an LB chart is also nothing special to it and it should be easily achievable with the charts.

It seems the 'series' data is arranged to 'compare' one another - but when the user do not want a compariso, why not put the data in the same column or bar ?

Some Chart software makers give the facility to make the Yamazumi type of charts using the same chart programs - without restructuring the data and without writing any vb.net code. This type of chart is possible with directly - One has to select the chart and bind the data.

I thought there might be a way in the microsoft charts also..but I do not know why it has not been given.

Anyway Thank you very much for the answer. I am marking the question as solved.

Rgds

Renga

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.