I have a “live” color map control. Range of Z-values always comprehends zero, but is not symmetrical about zero. I would like to show only the tick at zero (and no others), and only the label ‘0’ (no formatting) at that tick. Is there a simple solution?
- Harry Reichard asked 5 years ago
- You must login to post comments
Hi Harry,
There’s a property on HeatmapColorMap called AxisStyle. This accepts a WPF Style which is applied to the axis inside the heatmapcolormap.
As an example of use, we have one in our Non Uniform Heatmap example
<s:HeatmapColorMap Margin="40,20"
Grid.Column="1"
HorizontalAlignment="Right"
VerticalAlignment="Stretch"
Background="{Binding Source={x:Reference Name=sciChart}, Path=Background}"
Foreground="{Binding Source={x:Reference Name=sciChart}, Path=Foreground}"
ColorMap="{Binding Source={x:Reference Name=heatmapSeries}, Path=ColorMap.GradientStops, Converter={StaticResource ColorsToLinearGradientBrushConverter}}"
Minimum="{Binding Source={x:Reference Name=heatmapSeries}, Path=ColorMap.Minimum, Mode=TwoWay}"
Maximum="{Binding Source={x:Reference Name=heatmapSeries}, Path=ColorMap.Maximum, Mode=TwoWay}"
TextFormatting="0.00"
Opacity="0.8"
BorderBrush="#777"
BorderThickness="1"
Orientation="Vertical" >
<s:HeatmapColorMap.AxisStyle>
<Style TargetType="{x:Type s:NumericAxis}">
<Setter Property="Margin" Value="-15,0,-10,0"/>
<Setter Property="DrawMajorTicks" Value="False"/>
<Setter Property="DrawMinorTicks" Value="False"/>
<Setter Property="DrawMajorGridLines" Value="False"/>
<Setter Property="DrawMinorGridLines" Value="False"/>
</Style>
</s:HeatmapColorMap.AxisStyle>
</s:HeatmapColorMap>
With this style you can do anything to the heatmap’s axis that you can to a normal SciChartSurface’s axis. For example, if you wanted to hide all ticks except zero then you could use the TickProvider API.
So your final solution might look something like this:
<s:HeatmapColorMap>
...
<s:HeatmapColorMap.Resources>
<!-- Create and declare a tick provider -->
<CustomTickProvider x:Key="CustomTickProvider"/>
</s:HeatmapColorMap.Resources>
<s:HeatmapColorMap.AxisStyle>
<Style TargetType="{x:Type s:NumericAxis}">
<Setter Property="TickProvider" Value="{DynamicResource CustomTickProvider}"/>
</Style>
</s:HeatmapColorMap.AxisStyle>
</s:HeatmapColorMap>
Best regards,
Andrew
- Andrew Burnett-Thompson answered 5 years ago
-
Many thanks. You guys are good! Harry.
- You must login to post comments
Please login first to submit.