Jump to content
Software FX Community

Displaying Numerical count and percentage for a Stacked bar with 3 series


LolaC

Recommended Posts

Hi,

I have a stacked bar with 3 series and each series represents a task complete percentage per project. The problem is that I need to display the task completion percentage and the number of task completed for each series per project. How can i go about this?

Thanks.

Link to comment
Share on other sites

Posted Image

I need to display the number of "Tasks Completed" for each project and the "Task Completion %". Right now, each embedded number in the graph represents the "Task Completion %". For instance, the first bar "ARAS" has 25, 3, and 72 but I need the embedded number to represent the number of "Tasks completed" and the bar height to represent the "Task Completion %".

 ARAS

100% Completion (Number of Tasks Completed): 8

100% Completion Percentage: 25

50% to 100% Completion (Number of Tasks Completed): 1

50% to 100% Completion Percentage: 3

Less than 50% Completion (Number of Tasks Completed): 23

Less than 50% Completion Percentage: 72

This is how I assign the Completion percentage for each series:

Chart2.Data.Y(0, J) = (CompletePercent(J))

Chart2.Data.Y(1, J) = (Morethan50CompletePercent(J))

Chart2.Data.Y(2, J) = (Lessthan50CompletePercent(J))

The number of tasks completed are retrieved from three different arrays: countcomplete, Morethan50Complete and Less than50Complete.

I hope that helps. Thanks

Link to comment
Share on other sites

Thanks for your reply. I tried using the PointLabelAttributes.Format Property but is not doing what I need. The chart still displays Y data ("Completion Percentage") instead of the data I'm setting for the Point Labels ("Number of Tasks Completed"). The "Number of Tasks Completed" is generated dynamically so I cannot add it as text. This is how i'm calling the Point Labels. Also, the last series point label is not visible in the chart even though I'm making all the series visible. Please see file attached. Thanks. 

Chart2.Data.Points = temp

While (J < temp)

Chart2.Data.Y(0, J) = (CompletePercent(J))

Chart2.Data.Y(1, J) = (Morethan50CompletePercent(J))

Chart2.Data.Y(2, J) = (Lessthan50CompletePercent(J))

Chart2.AllSeries.PointLabels.Visible = True

Chart2.AllSeries.PointLabels.Format = (countcomplete(J))

Chart2.AllSeries.PointLabels.Format = (Morethan50Complete(J))

Chart2.AllSeries.PointLabels.Format = (Lessthan50Complete(J))

J += 1

End While

Link to comment
Share on other sites

This works for me. Can you post your results (C#, sorry, not so good with VB)?

                chart1.Data.Series = 3;

                chart1.Data.Points = 10;

                Random r = new Random();

                for (int i = 0; i < chart1.Data.Series; i++) {

                    for (int j = 0; j < chart1.Data.Points; j++) {

                        chart1.Data[i, j] = r.Next(100);

                    }

                }

                chart1.Gallery = Gallery.Bar;

                chart1.AllSeries.Stacked = Stacked.Stacked100;

                chart1.AllSeries.PointLabels.Visible = true; 

Link to comment
Share on other sites

I was able to get it to work. This is how I did it:

Chart2.Data.Series = 3

Dim temp As Integer = 0

Dim J As Integer = 0

Chart2.Data.Points = temp 

While (J < temp)

Chart2.AxisX.Labels(J) = tempProject

Chart2.Data.Y(0, J) = (CompletePercent(J))

Chart2.Data.Y(1, J) = (Morethan50CompletePercent(J))

Chart2.Data.Y(2, J) = (Lessthan50CompletePercent(J))

If Lessthan50CompletePercent(J) = "0" Then

Chart2.Data.Y(2, J) = "100"

End If

Chart2.Series(0).PointLabels.Visible = True

Chart2.Series(1).PointLabels.Visible =  True

 

Chart2.Series(2).PointLabels.Visible = True

Chart2.Points(0, J).Text = countcomplete(J)

Chart2.AllSeries.PointLabels.Format = "%L"

 

Chart2.AllSeries.PointLabels.LineAlignment = StringAlignment.Center

Chart2.Points(1, J).Text = Morethan50Complete(J)

Chart2.Points(2, J).Text = Lessthan50Complete(J)

J += 1

End While

 

Chart2.Series(0).Color = Color.LightGreen

Chart2.Series(1).Color = Color.LightYellow

Chart2.Series(2).Color = Color.Salmon

Chart2.Series(0).Text =

"100% Completion"

Chart2.Series(1).Text =

"50% to 100% Completion"

Chart2.Series(2).Text =

"Less than 50% Completion"

Chart2.Series(0).Gallery = Gallery.Bar

Chart2.Series(1).Gallery = Gallery.Bar

Chart2.Series(2).Gallery = Gallery.Bar

Dim tempMax As Integer = GetmaxAxisY(TBStart.Text, tempEnddate, measuredate)

Chart2.AxisY.Max = tempMax

Chart2.AxisY.Min = 0

Chart2.AxisY.Max = 100

Chart2.AxisY.Min = 0

Chart2.AxisY.Step = 10

Dim custom1 As ChartFX.WebForms.CustomGridLine

custom1 =

New ChartFX.WebForms.CustomGridLine

custom1.Value = 85

custom1.Color = Color.MediumSlateBlue

custom1.Width = 1.5

custom1.Style = Drawing2D.DashStyle.Dash

Chart2.AxisY.CustomGridLines.Add(custom1)

custom1.Text =

"Org Goal (85%)"

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...