使用C#在SciChart 3D工具提示中更改标签

时间:2018-11-27 14:44:02

标签: c# wpf scichart

是否可以使用C#更改工具提示修饰符的“文本”属性?

我想更改这些标签:

Image from *https://www.scichart.com/documentation/v5.x/webframe.html#TooltipModifier3D.html*

我正在使用“ WaterfallRenderableSeries3D ”。

我的代码:

<s3D:SciChart3DSurface x:Name="SciChartView1" 
            Height="850" Width="1400" 
            Margin="50,100,50,0" HorizontalAlignment="Left" VerticalAlignment="Top">
            <s3D:SciChart3DSurface.RenderableSeries>
                <s3D:WaterfallRenderableSeries3D x:Name="WaterfallSeriesView1" Style="{StaticResource WaterfallSeriesStyle}"/>
            </s3D:SciChart3DSurface.RenderableSeries>

            <s3D:SciChart3DSurface.XAxis>
                <s3D:NumericAxis3D/>
            </s3D:SciChart3DSurface.XAxis>

            <s3D:SciChart3DSurface.YAxis>
                <s3D:NumericAxis3D/>
            </s3D:SciChart3DSurface.YAxis>

            <s3D:SciChart3DSurface.ZAxis>
                <s3D:NumericAxis3D/>
            </s3D:SciChart3DSurface.ZAxis>

            <s3D:SciChart3DSurface.ChartModifier>
                <s3D:ModifierGroup3D>
                    <s3D:TooltipModifier3D CrosshairMode="Lines" IsEnabled="True"
                               SourceMode="AllSeries" ShowTooltipOn="MouseOver">
                    </s3D:TooltipModifier3D>
                </s3D:ModifierGroup3D>
            </s3D:SciChart3DSurface.ChartModifier>
        </s3D:SciChart3DSurface>

1 个答案:

答案 0 :(得分:1)

可以通过在XAML中应用模板来更改SciChart WPF 3D中工具提示上的标签。

看看SciChart WPF 3D Chart Documentation on Tooltips

  

工具提示项模板的样式

     

可以通过TooltipModifier3D.TooltipTemplate附加属性,以与RolloverModifier完全相同的方式设置工具提示项模板的样式。这为绑定到SeriesInfo实例的某些UI定义了一个DataTemplate。有关SeriesInfo类型的完整说明,请参见RolloverModifier

<!-- where xmlns:s3D="http://schemas.abtsoftware.co.uk/scichart3D" -->
<s3D:SciChart3DSurface>
   <s3D:SciChart3DSurface.Resources>

        <s3D:Vector3ComponentConverter x:Key="Vector3ComponentConverter" />

        <DataTemplate x:Key="XyzSeriesTooltipTemplate" DataType="cd:BaseXyzSeriesInfo3D">
            <StackPanel Orientation="Vertical">
                <TextBlock>
                    <Run FontWeight="Bold" Text="{Binding SeriesName, FallbackValue='Xyz 3D Point', TargetNullValue='Xyz 3D Point'}" />
                </TextBlock>
                <Border
                    Height="1"
                    Margin="3"
                    HorizontalAlignment="Stretch"
                    Background="DimGray"
                    BorderThickness="0" />
                <TextBlock>
                    <Run FontWeight="Bold" Text="X: " />
                    <Run Text="{Binding HitVertex, Converter={StaticResource Vector3ComponentConverter}, ConverterParameter='X'}" />
                </TextBlock>
                <TextBlock>
                    <Run FontWeight="Bold" Text="Y: " />
                    <Run Text="{Binding HitVertex, Converter={StaticResource Vector3ComponentConverter}, ConverterParameter='Y'}" />
                </TextBlock>
                <TextBlock>
                    <Run FontWeight="Bold" Text="Z: " />
                    <Run Text="{Binding HitVertex, Converter={StaticResource Vector3ComponentConverter}, ConverterParameter='Z'}" />
                </TextBlock>
            </StackPanel>
        </DataTemplate>
   </s3D:SciChart3DSurface.Resources>

   <s3D:SciChart3DSurface.RenderableSeries>
      <s3D:XyScatterRenderableSeries3D s3D:TooltipModifier3D.IncludeSeries="False"
                                       s3D:TooltipModifier3D.TooltipTemplate="{StaticResource XyzTooltipTemplate}"//>
   </s3D:SciChart3DSurface.RenderableSeries>
</s3D:SciChartSurface>

如果要在c#代码中应用这些更改,还可以考虑使用following techniquethis technique应用模板。