This is a migrated thread and some comments may be shown as answers.

Change Bubble color at run time

2 Answers 85 Views
Chart
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
jason
Top achievements
Rank 1
jason asked on 13 Jun 2012, 07:29 PM
I am trying to restyle the bubbles in a Bubble series so they look a little more 3-d.  I have accomplished this with a radial gradiant in this style here:

<Style x:Key="CustomBubbleStyle" TargetType="chart:Bubble">
           <Setter Property="Template">
               <Setter.Value>
                   <ControlTemplate TargetType="chart:Bubble">
                       <Canvas >
                       <Ellipse x:Name="PART_BubbleElement"
                             Canvas.Left="{TemplateBinding Left}"
                             Canvas.Top="{TemplateBinding Top}"
                             Width="{TemplateBinding Diameter}"
                             Height="{TemplateBinding Diameter}"
                              >
                               <Ellipse.Fill>
               <RadialGradientBrush>
                   <GradientStop Color="#FFF5F5F9"/>
                   <GradientStop Color="#FF091E8F" Offset="0.989"/>
               </RadialGradientBrush>
           </Ellipse.Fill>
                               </Ellipse>
                       </Canvas>
                   </ControlTemplate>
               </Setter.Value>
           </Setter>
       </Style>


My problem is that in every example I have seen you have to set the colors at design time.  In out scenario I have built a control that extends the RadChart.  I have a dependency property which is a list of brushes. If that is set then I use those colors.  If not then I use your default colors.  I was thinking I could catch the item when the color is set and then change it to add a gradiant so it is the same color just with the gradient added but I can't seem to figure out if that is possible.  Something like setting the fill property to Bind to something in Bubble and then using a converter to add the gradient.  Is anything like this possible or do I just need to come up with new default colors on my own and do it that way?  Sorry if this does not make sense as I was having trouble figuring out how to explain it.  Thanks.

2 Answers, 1 is accepted

Sort by
0
Accepted
Sia
Telerik team
answered on 18 Jun 2012, 07:42 AM
Hello Jason,

Unfortunately in RadChart there is no easy way for getting the default colors in the way you need. That is why I can suggest you two possible solutions:
  • new default colors as you mentioned
  • or using universal gradient [black and white with transparency] which can be used on every bubble's fill. If you need help with this, please let me know.

Greetings,
Sia
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
jason
Top achievements
Rank 1
answered on 18 Jun 2012, 07:12 PM
I went ahead and just set a default color scheme using the colors from one of your themes.  Thanks.
Tags
Chart
Asked by
jason
Top achievements
Rank 1
Answers by
Sia
Telerik team
jason
Top achievements
Rank 1
Share this question
or