I have a bubble chart and I need to have a custom marker assigned to the bubbles. I am currently using the Format method on the marker to put text as the marker but I need something more powerful. I was hoping to make a custom marker with a StackPanel in it to allow me to have even more formatting power.
As a first cut I tried the following:
Style set as
<Style x:Key="RankingMarker" TargetType="igChart:MarkerPointTemplate"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="igChart:MarkerPointTemplate"> <TextBlock Text="fred"></TextBlock> </ControlTemplate> </Setter.Value> </Setter> </Style>
Attached to the Datapoint as
var point1 = new DataPoint { Marker = new Marker { Enabled = true, //Format = // string.Format("{2}\n{0} SKUS\n{1} Units", dataPoint.ActualVASku, // dataPoint.ActualVAUnits, dataPoint.Rating), Type = MarkerType.Custom, Style = Application.Current.Resources["RankingMarker"] as Style, } };The marker is not using the style at all. What am I doing wrong?Thanks
Hi there,
The Bubbles for the BubbleSeries are not actually markers, and therefore creating a MarkerPointTemplate and setting the style for a DataPoint's marker won't work. What you can do, is create a BubbleChartDataPointTemplate style and apply this to the Style property of your DataPoint. I've illustrated this below:
Style set as:
<Style x:Key="RankingMarker" TargetType="igChart:BubbleChartDataPointTemplate"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="igChart:MarkerPointTemplate"> <TextBlock Text="fred"></TextBlock> </ControlTemplate> </Setter.Value> </Setter> </Style>
Attached to the Datapoint as:
var point1 = new DataPoint{ Style = this.Resources["RankingMarker"] as Style; };
Hope this helps!
-Marisa
Looks like some of my code got messed up upon copying and pasting.
var point1 = new DataPoint
{
Style = this.Resource["RankingMarker"] as Style;
}