Re: how can i change the interior colors of pies?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Alvin Bruney [MVP] (vapor)
Date: 10/28/04


Date: Thu, 28 Oct 2004 11:34:36 -0500

use the chpoints object. Each point will represent a slice of the pie so you
can color the point in question appropriately. Here is an excerpt from
Chapter 3 - O.W.C. Black Book with .NET [Dec 2004]:

For out sample, we will use the interior property to customize the color of
a series.

Figure 3.24 sample code to customize color

C# Snippet

for (int i = 0; i <
objCSpace.Charts[0].SeriesCollection[0].Points.Count;i++)

{

object val = (object)objCSpace.Charts[0].

SeriesCollection[0].Points[i].GetValue

(O.W.C. version 10.ChartDimensionsEnum.chDimValues, null);

if(Int32.Parse(val.ToString()) > 40)

objCSpace.Charts[0].SeriesCollection[0].Points [i].Interior.Color = "red";

else if(Int32.Parse(val.ToString()) < 15)

objCSpace.Charts[0].SeriesCollection[0].Points [i].Interior.Color =
"limegreen";

}

-- 
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
"Charles Waterhouse" <cwaterhouse@sitedynamics.com> wrote in message 
news:aff99622.0410271241.5f4f3d0@posting.google.com...
> The problem with using the Interior object of the Datalabels Object is
> that it changes the color for the entire pie. How can you change the
> color for each segment of the pie?
>
> "Thao Moua [ms]" <ThaoMouams@discussions.microsoft.com> wrote in message 
> news:<0E053020-79F2-4692-8F80-65E99EEDABC6@microsoft.com>...
>> The Interior object contains all the properties you need to change the 
>> visual
>> formattings such as color and background.  The font is accessed through 
>> the
>> Font object branching from the object you want to manipulate (ie Title.)
>>
>> Can you clarify your question "how can i set the corrosponding value to 
>> the
>> pie?"  Your code already set the pie value via 
>> SeriesCollection(0).SetData()
>>
>>
>> ----------------------------------------------------------------------
>> Thao Moua
>> OWC Chartspace Support
>>
>> This posting is provided "AS IS" with no warranties, and
>> confers no rights. Use of included script samples are
>> subject to the terms specified at
>> http://www.microsoft.com/info/cpyright.htm
>> ----------------------------------------------------------------------
>> "info@epple-edv.de" wrote:
>>
>> > Hello everybody,
>> > i create a chart with the above code - works fine.
>> > my problem:
>> >
>> > how can i change the interior colors of the 4 pies?
>> > how can i change the bachgroundcolor of the chart?
>> > how can i change the font, font-size, font-color?
>> > how can i set the corrosponding value to the pie?
>> >
>> > thanks
>> > rainer from germany
>> >
>> > Option Explicit
>> >
>> >     Dim aryTimes
>> >     Dim aryValues
>> >     Dim objChart
>> >     Dim objCharts
>> >     Dim objConstants
>> >     Dim strFileName
>> >
>> >     Set objCharts = Createobject("OWC11.Chartspace")
>> >     Set objConstants = objCharts.Constants
>> >
>> >     aryTimes = Array("1997", "1999", "2000", "2003")
>> >     aryValues = Array(49000, -7800, -19000, 15000)
>> >
>> >     With objCharts
>> >         .HasChartSpaceTitle = True
>> >         .ChartSpaceTitle.Caption = "creating charts using microsoft 
>> > office
>> > web components"
>> >         .ChartLayout = objConstants.chChartLayoutHorizontal
>> >     End With
>> >
>> >     Call AddChart(objCharts, objConstants, aryValues, aryTimes,
>> > objConstants.chChartTypePieExploded3D)
>> >     Response.ContentType = "image/GIF"
>> >     Response.BinaryWrite objCharts.GetPicture("GIF", 400, 400)
>> >
>> >     Set objCharts = Nothing
>> >     Set objConstants = Nothing
>> >
>> >
>> >     Sub AddChart(objCharts, objConstants, aryData, aryDescription,
>> > intChartType)
>> >         Dim objChart
>> >         Set objChart = objCharts.Charts.Add
>> >
>> >         With objChart
>> >             .Type = intChartType
>> >             .SetData objConstants.chDimCategories,
>> > objConstants.chDataLiteral, aryDescription
>> >             .SeriesCollection(0).SetData objConstants.chDimValues,
>> > objConstants.chDataLiteral, aryData
>> >         End With
>> >
>> >         Set objChart = Nothing
>> >     End Sub
>> >
>> >
>> > 


Relevant Pages

  • RE: how can i change the interior colors of pies?
    ... Your code already set the pie value via SeriesCollection.SetData ... > Dim aryValues ... > Dim objChart ... > Set objConstants = objCharts.Constants ...
    (microsoft.public.office.developer.web.components)
  • Re: Segments
    ... I'm using the Pie API with a few COS as SIN functions thrown in. ... sample you posted - the segment is the right size but in the wrong place. ... Dim CPoint As POINTAPI ...
    (comp.lang.basic.visual.misc)
  • Re: how can i change the interior colors of pies?
    ... The problem with using the Interior object of the Datalabels Object is ... that it changes the color for the entire pie. ... >> Dim aryValues ... >> Call AddChart(objCharts, objConstants, aryValues, aryTimes, ...
    (microsoft.public.office.developer.web.components)