J'essaye d'obtenir une série de barre pour "rebondir" en dessinant, j'ai supposé que le BounceEase TransitionEasingFunction le ferait mais les lignes se fondent juste dedans, j'ai posté le xaml et le code derrière ci-dessous, n'importe qui sais où je suis allé mal ou est-ce plus complexe que je pensais, je suis assez nouveau pour SilverLightBounceEase et silverlight 4 BarSeries
XAML
<Grid x:Name="LayoutRoot" Background="White">
<chartingToolkit:Chart x:Name="MyChart">
<chartingToolkit:BarSeries Title="Sales" ItemsSource="{Binding}" IndependentValuePath="Name" DependentValuePath="Value" AnimationSequence="FirstToLast" TransitionDuration="00:00:3">
<chartingToolkit:BarSeries.TransitionEasingFunction>
<BounceEase EasingMode="EaseInOut" Bounciness="5" />
</chartingToolkit:BarSeries.TransitionEasingFunction>
<chartingToolkit:BarSeries.DataPointStyle>
<Style TargetType="Control">
<Setter Property="Background" Value="Red"/>
</Style>
</chartingToolkit:BarSeries.DataPointStyle>
</chartingToolkit:BarSeries>
<chartingToolkit:Chart.Axes>
<chartingToolkit:LinearAxis Title="Types owned" Orientation="X" Minimum="0" Maximum="300"
Interval="10" ShowGridLines="True" FontStyle='Italic'/>
</chartingToolkit:Chart.Axes>
</chartingToolkit:Chart>
</Grid>
Code
derrière
public class MyClass : DependencyObject
{
public string Name { get; set; }
public Double Value {
get { return (Double)GetValue(myValueProperty); }
set{SetValue(myValueProperty,value);}
}
public static readonly DependencyProperty myValueProperty =
DependencyProperty.Register("Value", typeof(Double), typeof(MyClass), null);
}
public MainPage()
{
InitializeComponent();
//Get the data
IList<MyClass> l = this.GetData();
//Get a reference to the SL Chart
MyChart.DataContext = l.OrderBy(e => e.Value);
//Find the highest number and round it up to the next digit
DispatcherTimer myDispatcherTimer = new DispatcherTimer();
myDispatcherTimer.Interval = new TimeSpan(0, 0, 0, 5, 0); // 100 Milliseconds
myDispatcherTimer.Tick += new EventHandler(Each_Tick);
myDispatcherTimer.Start();
}
public void Each_Tick(object o, EventArgs sender)
{
((BarSeries)MyChart.Series[0]).DataContext = GetData();
}
private IList<MyClass> GetData()
{
Random random = new Random();
return new List<MyClass>()
{
new MyClass() {Name="Bob Zero",Value=(random.NextDouble() * 100.0)},
new MyClass() {Name="Bob One",Value=(random.NextDouble() * 100.0)},
new MyClass() {Name="Bob Two",Value=(random.NextDouble() * 100.0)},
new MyClass() {Name="Bob Three",Value=(random.NextDouble() * 100.0)}
};
}
Merci, ça l'explique parfaitement et explique aussi certains des exemples que j'ai vus. Cela fait sens – Pharabus