Windows Phone 7 amCharts x-axis label
-
14-06-2021 - |
Question
Anyone knows how to remove the labels from the x-axis in a Windows Phone 7 amCharts chart? Should be simple but I can't find a way to do it.
So far I have the following:
<AmCharts_Windows_QuickCharts:SerialChart x:Name="chart1" DataSource="{Binding Data}"
CategoryValueMemberPath="Date"
AxisForeground="White"
PlotAreaBackground="Black"
GridStroke="DarkGray"
ScrollViewer.HorizontalScrollBarVisibility="Auto">
<AmCharts_Windows_QuickCharts:SerialChart.Graphs>
<AmCharts_Windows_QuickCharts:LineGraph ValueMemberPath="Value" Title="SomeTitle" Brush="Orange" />
</AmCharts_Windows_QuickCharts:SerialChart.Graphs>
</AmCharts_Windows_QuickCharts:SerialChart>
Thank you in advance.
Solution
you can do that by removing the CategoryValueMemberPath
from the SerialChart definition
<AmCharts_Windows_QuickCharts:SerialChart x:Name="chart1" DataSource="{Binding Data}"
AxisForeground="White"
PlotAreaBackground="Black"
GridStroke="DarkGray"
ScrollViewer.HorizontalScrollBarVisibility="Auto">
<AmCharts_Windows_QuickCharts:SerialChart.Graphs>
<AmCharts_Windows_QuickCharts:LineGraph ValueMemberPath="Value" Title="SomeTitle" Brush="Orange" />
</AmCharts_Windows_QuickCharts:SerialChart.Graphs>
You can also set the MinimumCategoryGridStep
to 0
If you want to have the ticks, but not the labels, you'll need to override the style of the SerialChart
<Style x:Key="CategoryAxisStyle1" TargetType="amq:CategoryAxis">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="amq:CategoryAxis">
<Grid Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition/>
</Grid.RowDefinitions>
<Rectangle x:Name="PART_AxisLine" Fill="{TemplateBinding Foreground}" HorizontalAlignment="Stretch" Height="2" Grid.Row="0" VerticalAlignment="Top"/>
<Canvas x:Name="PART_TickPanel" Height="5" Grid.Row="1" VerticalAlignment="Stretch"/>
<Canvas x:Name="PART_ValuesPanel" HorizontalAlignment="Stretch" Grid.Row="2" VerticalAlignment="Stretch" Visibility="Collapsed"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="SerialChartStyle1" TargetType="amq:SerialChart">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="amq:SerialChart">
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<amq:ValueAxis x:Name="PART_ValueAxis" Foreground="{TemplateBinding AxisForeground}" HorizontalAlignment="Right" Margin="0,0,0,-2" Grid.Row="0" Canvas.ZIndex="100"/>
<amq:CategoryAxis x:Name="PART_CategoryAxis" Foreground="{TemplateBinding AxisForeground}" Grid.Row="1" Style="{StaticResource CategoryAxisStyle1}"/>
<Border Background="{TemplateBinding PlotAreaBackground}" Grid.Row="0">
<amq:ValueGrid x:Name="PART_ValueGrid" Foreground="{TemplateBinding GridStroke}"/>
</Border>
<Border x:Name="PART_GraphCanvasDecorator" Grid.Row="0">
<Canvas x:Name="PART_GraphCanvas" Background="Transparent"/>
</Border>
<amq:Legend x:Name="PART_Legend" HorizontalAlignment="Left" Margin="10,0,0,0" Grid.Row="0" Visibility="{TemplateBinding LegendVisibility}" VerticalAlignment="Top"/>
<Canvas Grid.Row="0">
<amq:Balloon x:Name="PART_Balloon" BorderBrush="{TemplateBinding AxisForeground}" BorderThickness="2" Visibility="Collapsed"/>
</Canvas>
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow