Jump to content
Software FX Community
Active-X.COM

Adding Data to Pie Chart

Recommended Posts

I have a simple Pie (Donut) chart with the following Code:

 Set Chart1 = Server.CreateObject("ChartFX.ASP.Server")

 Set axis = Chart1.Axis(0)

 Set title = axis.Title

 title.Flags = TitleFlag_DrawingArea Or TitleFlag_NoChangeDockArea

 Chart1.PointLabels = true

 Chart1.Chart3D = true

 Chart1.LegendBox = true

 Chart1.Gallery = Gallery_Doughnut

 Chart1.OpenData COD_Values, 1, 4

Chart1.Value(0, 0) = sngTotal1

Chart1.Value(0, 1) = sngTotal2

Chart1.Value(0, 2) = sngTotal3

Chart1.Value(0, 3) = sngTotal4

 Chart1.CloseData(COD_Values)

I expect a 4-segment pie with the percentages displayed, based on the totals I give.  I am not supplying the percentage values.  I am supplying the totals.  Can the pie chart take the totals and display the percentages or do I have to supply the percentage values?

 

Share this post


Link to post
Share on other sites

You can use the PointLabelMask to display the percentage of total this point represents for a pie chart.

 chart1.PointLabelMask = "%p"

Please refer to the API documentation in the Resource Center for more information on the different options for the PointLabelMask. You can also use the TipMask property of the chart object to display as tooltip when user places cursor over a particular point in the chart.

Share this post


Link to post
Share on other sites

Well, that didn't really answer my question, which was "Can the pie chart take the totals and display the percentages or do I have to supply the percentage values?".  But it was related enough to get the end result.  The answer seems to be "Yes, you can supply the values rather than the percentages".

If I am misled, please let us all know.  I have to say the documentation is not very clear on how to go about doing many of the things the chart component can do.

 

One more question: My chart seems to display correctly now.  However (using the same code above), the pie values in the legend read "Value #1, Value #2, Value #3, and Value #4".  How do I change these to read the correct labels for each value? Again, I can't seem to find it in the documentation and trust me, I've looked!

 Thanks!

Share this post


Link to post
Share on other sites

You need to set the point legend as follows:

Chart1.LegendBox = True  

Chart1.Legend(0) = "January" 

Chart1.Legend(1) = "February" 

....

....

You can also refer to Chartfx Resource Center programmer's guide > Legends > Points Legend section.

Share this post


Link to post
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.

Loading...

×
×
  • Create New...