Jump to content
Software FX Community

Stacked Gantt chart drawn incorrectly


User (Legacy)

Recommended Posts

Posted

I'm using ChartFx for windows forms.net version 6.0.1262.25350 / assembly

version 6.0.839.0.

I am using a gantt chart. In particular, I am setting the stacked property

to stacked.normal to allow a single row to show multiple tasks for a given

activity.

I have a problem with gantt charts and how the bars are drawn on the screen.

I have distilled the problem down to the following sample code that

reproduces the problem (in the real application, data will be obtained from

a database, but hard coded values are sufficient to show the problem)

There are two problems:

* gaps not drawn between all activities

* final activity is drawn incorrectly

Problem 1: gaps not drawn between all activities

The code following produces the attached image. There are two problems:

The code draws a gantt chart with 3 series, each with 3 activities/points:

Action 0: 10-30, 50-60, 70-72

Action 1: 40-80, 100-105, 110-140

Action 2: 100-150, 155-170, 185-200

Thus, each action has 3 activities, and there is a gap between each

activity.

There is no gap shown between the second and third bars in the series. A gap

is shown between the first and second activity.

Problem 2: final activity is drawn incorrectly

The final activity (red bar in the attcahed image) is too long. For the

first series it shoul be from 70 to 72, yet it starts at 70 and extends to

about 160.

John

Code follows:

chart1.Gallery = Gallery.Gantt;

// First set the Min and Max for the Y-axis

chart1.AxisY.Min = 0;

chart1.AxisY.Max = 200;

// Then we can use the Value and IniValue for the Gantt Chart. Let's suppose

it has 3 bars

chart1.OpenData(COD.Values, 3, 3);

chart1.OpenData(COD.IniValues, 3, 3);

chart1.Legend[0] = "Action 0";

chart1.IniValue[0, 0] = 10;

chart1.Value[0, 0] = 30;

chart1.IniValue[1, 0] = 50;

chart1.Value[1, 0] = 60;

chart1.IniValue[2, 0] = 70;

chart1.Value[2, 0] = 72;

chart1.Legend[1] = "Action 1";

chart1.IniValue[0, 1] = 40;

chart1.Value[0, 1] = 80;

chart1.IniValue[1, 1] = 100;

chart1.Value[1, 1] = 105;

chart1.IniValue[2, 1] = 110;

chart1.Value[2, 1] = 140;

chart1.Legend[2] = "Action 2";

chart1.IniValue[0, 2] = 100;

chart1.Value[0, 2] = 150;

chart1.IniValue[1, 2] = 155;

chart1.Value[1, 2] = 170;

chart1.IniValue[2, 2] = 185;

chart1.Value[2, 2] = 200;

chart1.CloseData(COD.Values);

chart1.CloseData(COD.IniValues);

chart1.MultipleColors = false;

chart1.Stacked = Stacked.Normal;

Posted

A stacked chart will ACCUMULATE the values of the series. The end of second

series will be plotted by adding the values of the first and second series

together.

I looks to me like you don't want a stacked chart but rather a regular Gantt

chart with all the bars in the same x-axis position.

You can achieve this by setting Cluster = true, instead of setting the

Stacked property.

--

FP

Software FX, Inc.

Posted

Thanks,

cluster = true and stacked = no does the trick.

"SoftwareFX Support" <support@softwarefx.com> wrote in message

news:wFrcENUTDHA.3416@WEBSERVER1...

> A stacked chart will ACCUMULATE the values of the series. The end of

second

> series will be plotted by adding the values of the first and second series

> together.

>

> I looks to me like you don't want a stacked chart but rather a regular

Gantt

> chart with all the bars in the same x-axis position.

>

> You can achieve this by setting Cluster = true, instead of setting the

> Stacked property.

>

> --

> FP

> Software FX, Inc.

>

>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...