When setting the sync channel across charts, for some reason every chart but the targeted chart begin zooming in and out on mouse-scroll.
How do you prevent this? It has to be some sort of bug.
FWIW: If i handle the PreviewMouseWheel event, at least I can stop the bug.
Bottom line, if you use the original code sample you provided, disable horizontal and vertical zooming (as per my first response), you will encounter the bug where if you focus one of the two charts, use your mouse-wheel to zoom, the other chart does this odd zooming in and out. Zooming is never fully disabled.
Per the code sample in the other thread: http://ko.infragistics.com/community/forums/t/95695.aspx attached is the best I can come up with regarding the desired result.
<UserControl.Resources> <ResourceDictionary> <StackPanel TextBlock.FontSize="10" TextBlock.FontWeight="Normal" x:Key="Tooltip"> <StackPanel Orientation="Horizontal"> <TextBlock MinWidth="50" Text="Pnl" Margin="0,0,4,0" FontWeight="Bold"/> <TextBlock Text="{Binding Item.CumulativePnl, StringFormat={}{0:0,,.00;-0,,.00;0}}" /> </StackPanel> <StackPanel Orientation="Horizontal"> <TextBlock MinWidth="50" Text="Industry" Margin="0,0,4,0" FontWeight="Bold"/> <TextBlock Text="{Binding Item.CumulativePnlIndustry, StringFormat={}{0:0,,.00;-0,,.00;0}}" /> </StackPanel> <StackPanel Orientation="Horizontal"> <TextBlock MinWidth="50" Text="Market" Margin="0,0,4,0" FontWeight="Bold"/> <TextBlock Text="{Binding Item.CumulativePnlMarket, StringFormat={}{0:0,,.00;-0,,.00;0}}" /> </StackPanel> <StackPanel Orientation="Horizontal"> <TextBlock MinWidth="50" Text="Style" Margin="0,0,4,0" FontWeight="Bold"/> <TextBlock Text="{Binding Item.CumulativePnlStyle, StringFormat={}{0:0,,.00;-0,,.00;0}}" /> </StackPanel> <StackPanel Orientation="Horizontal"> <TextBlock MinWidth="50" Text="Alpha" Margin="0,0,4,0" FontWeight="Bold"/> <TextBlock Text="{Binding Item.CumulativePnlBarraAlpha, StringFormat={}{0:0,,.00;-0,,.00;0}}" /> </StackPanel> <StackPanel Orientation="Horizontal"> <TextBlock MinWidth="50" Text="Alpha+" Margin="0,0,4,0" FontWeight="Bold"/> <TextBlock Text="{Binding Item.CumulativePnlBarraAlphaPlus, StringFormat={}{0:0,,.00;-0,,.00;0}}" /> </StackPanel> <TextBlock Text="{Binding Item.TradeDate, StringFormat='MM-dd-yyyy'}" /> </StackPanel> </ResourceDictionary> </UserControl.Resources>
<HeaderedContentControl HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" Style="{StaticResource Tile}" > <HeaderedContentControl.Header> <StackPanel HorizontalAlignment="Center"> <StackPanel Orientation="Horizontal" HorizontalAlignment="Center"> <TextBlock Text="{Binding Display}" TextTrimming="CharacterEllipsis" MaxWidth="150" Style="{StaticResource TileHeader}" /> <TextBlock Text=" vs. Barra Benchmark" Style="{StaticResource TileHeader}" /> </StackPanel> <ig:Legend x:Name="Legend1" Orientation="Horizontal" HorizontalAlignment="Center"/> </StackPanel> </HeaderedContentControl.Header>
<Grid> <Grid.RowDefinitions> <RowDefinition Height="*" /> <RowDefinition Height="Auto" /> </Grid.RowDefinitions>
<ig:XamDataChart Margin="2,2,50,0" ToolTipStyle="{DynamicResource ToolTipStyle}" Legend="{Binding ElementName=Legend1}" HorizontalZoomable="True" VerticalZoomable="True" ig:SyncManager.SyncSettings="{StaticResource SYNCChannel}" CrosshairVisibility="{Binding Source={x:Static Models:Settings.Current}, Path=ShowCrosshairs, Converter={StaticResource BTV}}" CrosshairLineStyle="{DynamicResource ABCrosshairLineStyle}" > <ig:XamDataChart.Axes> <!--<ig:CategoryDateTimeXAxis MinimumValue="{Binding Filters.StartDate}" MaximumValue="{Binding Filters.EndDate}" DateTimeMemberPath="TradeDate" x:Name="XAxis2" ItemsSource="{Binding PositionTimeseries}" Label="{}{TradeDate:dd MMM}" />--> <ig:CategoryXAxis x:Name="XAxis2" ItemsSource="{Binding PositionTimeseries}" Label="{}{TradeDate:M/d/yy}" LabelSettings="{DynamicResource LabelSettingsBottom}"/> <ig:NumericYAxis x:Name="YAxis2" Label="{}{0:0,,.00;-0,,.00;0}" Title="(MM)" LabelSettings="{DynamicResource LabelSettingsLeft}"/> </ig:XamDataChart.Axes> <ig:XamDataChart.Series> <ig:AreaSeries ToolTip="{StaticResource Tooltip}" LegendItemTemplate="{DynamicResource CenteredLegendItemTemplate}" IsHighlightingEnabled="False" XAxis="{Binding ElementName=XAxis2}" YAxis="{Binding ElementName=YAxis2}" ItemsSource="{Binding PositionTimeseries}" Title="PnL" ValueMemberPath="CumulativePnl" Brush="{DynamicResource Risk_PnLTotalArea}" Outline="#CECECE" Thickness="1" BorderThickness="1" UnknownValuePlotting="LinearInterpolate" /> <ig:ValueOverlay Axis="{Binding ElementName=YAxis2}" Style="{DynamicResource ZeroValueOveraly}" /> <ig:LineSeries ToolTip="{StaticResource Tooltip}" LegendItemTemplate="{DynamicResource CenteredLegendItemTemplate}" XAxis="{Binding ElementName=XAxis2}" YAxis="{Binding ElementName=YAxis2}" ItemsSource="{Binding PositionTimeseries}" Title="Industry" ValueMemberPath="CumulativePnlIndustry" MarkerType="None" Brush="{DynamicResource Risk_PnLIndustryLine}" UnknownValuePlotting="LinearInterpolate" /> <ig:LineSeries ToolTip="{StaticResource Tooltip}" LegendItemTemplate="{DynamicResource CenteredLegendItemTemplate}" XAxis="{Binding ElementName=XAxis2}" YAxis="{Binding ElementName=YAxis2}" ItemsSource="{Binding PositionTimeseries}" Title="Market" ValueMemberPath="CumulativePnlMarket" MarkerType="None" Brush="{DynamicResource Risk_PnLMarketLine}" UnknownValuePlotting="LinearInterpolate" /> <ig:LineSeries ToolTip="{StaticResource Tooltip}" LegendItemTemplate="{DynamicResource CenteredLegendItemTemplate}" XAxis="{Binding ElementName=XAxis2}" YAxis="{Binding ElementName=YAxis2}" ItemsSource="{Binding PositionTimeseries}" Title="Style" ValueMemberPath="CumulativePnlStyle" MarkerType="None" Brush="{DynamicResource Risk_PnLStyleLine}" UnknownValuePlotting="LinearInterpolate" /> <ig:LineSeries ToolTip="{StaticResource Tooltip}" LegendItemTemplate="{DynamicResource CenteredLegendItemTemplate}" XAxis="{Binding ElementName=XAxis2}" YAxis="{Binding ElementName=YAxis2}" ItemsSource="{Binding PositionTimeseries}" Title="Alpha" ValueMemberPath="CumulativePnlBarraAlpha" MarkerType="None" Brush="{DynamicResource Risk_PnlAlphaLine}" UnknownValuePlotting="LinearInterpolate" /> <ig:LineSeries ToolTip="{StaticResource Tooltip}" LegendItemTemplate="{DynamicResource CenteredLegendItemTemplate}" XAxis="{Binding ElementName=XAxis2}" YAxis="{Binding ElementName=YAxis2}" ItemsSource="{Binding PositionTimeseries}" Title="Alpha+" ValueMemberPath="CumulativePnlBarraAlphaPlus" MarkerType="None" Brush="{DynamicResource Risk_PnlAlphaPlusLine}" DashArray="1,1" UnknownValuePlotting="LinearInterpolate"> <ig:LineSeries.LegendItemBadgeTemplate> <DataTemplate> <Line X1="0" Y1="0" X2="18" Y2="0" Stroke="{DynamicResource Risk_PnlAlphaPlusLine}" StrokeThickness="2" Margin="0,0,4,0" SnapsToDevicePixels="True" StrokeDashArray="1, 1" /> </DataTemplate> </ig:LineSeries.LegendItemBadgeTemplate> </ig:LineSeries> <ig:CrosshairLayer HorizontalLineVisibility="Collapsed" /> <ig:ItemToolTipLayer UseInterpolation="True" /> </ig:XamDataChart.Series> </ig:XamDataChart>
<Border HorizontalAlignment="Center" Grid.Row="1" Opacity=".7" Margin="-4,0,0,8"> <DockPanel TextBlock.FontSize="9" > <TextBlock Text="Pnl: " DockPanel.Dock="Left" FontWeight="Bold" /> <TextBlock Text="{Binding LastPosition.CumulativePnl, StringFormat={}{0:0,,.00;(0,,.00);0}}" DockPanel.Dock="Left" Behaviors:TextBlockBehaviors.RedIfNegative="True"/> <TextBlock Text=" Industry: " DockPanel.Dock="Left" FontWeight="Bold"/> <TextBlock Text="{Binding LastPosition.CumulativePnlIndustry, StringFormat={}{0:0,,.00;(0,,.00);0}}" DockPanel.Dock="Left" Behaviors:TextBlockBehaviors.RedIfNegative="True"/> <TextBlock Text=" Market: " DockPanel.Dock="Left" FontWeight="Bold"/> <TextBlock Text="{Binding LastPosition.CumulativePnlMarket, StringFormat={}{0:0,,.00;(0,,.00);0}}" DockPanel.Dock="Left" Behaviors:TextBlockBehaviors.RedIfNegative="True"/> <TextBlock Text=" Style: " DockPanel.Dock="Left" FontWeight="Bold"/> <TextBlock Text="{Binding LastPosition.CumulativePnlStyle, StringFormat={}{0:0,,.00;(0,,.00);0}}" DockPanel.Dock="Left" Behaviors:TextBlockBehaviors.RedIfNegative="True"/> <TextBlock Text=" Alpha: " DockPanel.Dock="Left" FontWeight="Bold"/> <TextBlock Text="{Binding LastPosition.CumulativePnlBarraAlpha, StringFormat={}{0:0,,.00;(0,,.00);0}}" DockPanel.Dock="Left" Behaviors:TextBlockBehaviors.RedIfNegative="True"/> <TextBlock Text=" Alpha+: " DockPanel.Dock="Left" FontWeight="Bold"/> <TextBlock Text="{Binding LastPosition.CumulativePnlBarraAlphaPlus, StringFormat={}{0:0,,.00;(0,,.00);0}}" DockPanel.Dock="Left" Behaviors:TextBlockBehaviors.RedIfNegative="True"/> </DockPanel> </Border>
</Grid>
</HeaderedContentControl>
Ultimately, i want the ability to sync cross hairs and preferably show tooltips on each chart. Zooming must be off because we are using the mouse-scroll wheel for other functionality thus it mus be disabled.
Attached is a screenshot of the desired result.
Mark,
Could you clarify why you are setting sync channel if you don't want the chart's to zoom? Are you using it solely to sync the crosshairs or the annotation layers?
-Graham
Thanks for the reply.
Modify your chart xaml as follows and you will see the bug. Essentially, our end users only want the ability to show crosshairs to line up data points and that's all. Zooming is very cumbersome as we have many charts on screen (think dashboard).
<igChart:XamDataChart x:Name="dataChart"
Grid.Column="0" HorizontalZoomable="False" VerticalZoomable="False" CrosshairVisibility="Visible" >