- Home
- Forum
- Xamarin.Forms
- SfChart date time position at primary axis
SfChart date time position at primary axis
Hi,
Attachment: Screenshot_sfchart_21b1daca.zip
in a Syncfusion Chart element I'm not able to don't show the last label indicated by the red arrow at the attached screenshot, what is the simplest solution?
Piece of code:
<sfChart:SfChart BackgroundColor="Transparent">
<sfChart:SfChart.ChartBehaviors>
<sfChart:ChartTooltipBehavior/>
<sfChart:ChartZoomPanBehavior EnableZooming="True" EnableDoubleTap="True" EnableSelectionZooming="False" ZoomMode="XY" MaximumZoomLevel="4"/>
</sfChart:SfChart.ChartBehaviors>
<sfChart:SfChart.Legend>
<sfChart:ChartLegend DockPosition="Bottom" ToggleSeriesVisibility="True" IconWidth="14" IconHeight="14" MaxWidth="10" ItemMargin="5,0"/>
</sfChart:SfChart.Legend>
<!--X axis, Time"-->
<sfChart:SfChart.PrimaryAxis>
<sfChart:DateTimeAxis Minimum="{Binding XMinDate}" Maximum="{Binding XMaxDate}" MaximumLabels="4" RangePadding="None" LabelRotationAngle="10" IntervalType="Hours" Interval="24" MinorTicksPerInterval="5" EnableAutoIntervalOnZooming="False" ShowMajorGridLines="True" ShowMinorGridLines="False">
<sfChart:DateTimeAxis.LabelStyle>
<sfChart:ChartAxisLabelStyle LabelFormat="hh:mmtt" LabelAlignment="Center"/>
</sfChart:DateTimeAxis.LabelStyle>
</sfChart:DateTimeAxis>
</sfChart:SfChart.PrimaryAxis>
<!--Y axis, Temperature-->
<sfChart:SfChart.SecondaryAxis>
<sfChart:NumericalAxis Minimum="{Binding YMinValue}" Maximum="{Binding YMaxValue}" RangePadding="None" Interval="2" MinorTicksPerInterval="1" EnableAutoIntervalOnZooming="False" ShowMajorGridLines="True" ShowMinorGridLines="False">
</sfChart:NumericalAxis>
</sfChart:SfChart.SecondaryAxis>
<!--Chart data-->
<sfChart:SfChart.Series>
<!--...-->
</sfChart:SfChart.Series>
</sfChart:SfChart>
Attachment: Screenshot_sfchart_21b1daca.zip
SIGN IN To post a reply.
5 Replies
SM
Saravanan Madheswaran
Syncfusion Team
September 8, 2020 12:44 PM UTC
Hi Vito,
Greetings from Syncfusion.
We would like to let you know that we can Fit, Shift or Hide the axis edge labels using
EdgeLabelsDrawingMode property. Please check the help document below for more information. For more about axis labels customization, please check below links
Regards,
Saravanan.
SS
Seitron spa
September 9, 2020 09:20 AM UTC
Hi,
I didn't find the wanted solution and as work around I hided the edge labels by means of EdgeLabelsDrawingMode="Hide", even if I wanted to hide only the end edge label.
Regards,
Vito
SM
Saravanan Madheswaran
Syncfusion Team
September 10, 2020 12:35 PM UTC
Hi Vito,
We can achieve your requirement “Hide only the end edge label” by removing the label content at LabelCreated event.
Xaml:
|
<chart:SfChart.PrimaryAxis>
<chart:DateTimeAxis LabelCreated="DateTimeAxis_LabelCreated"
Minimum="{Binding XMinDate}"
Maximum="{Binding XMaxDate}"
MaximumLabels="4"
>
. . .
</chart:DateTimeAxis>
</chart:SfChart.PrimaryAxis> |
C#:
|
private void DateTimeAxis_LabelCreated(object sender, ChartAxisLabelEventArgs e)
{
var oADate = viewModel.XMaxDate.ToOADate();
if(oADate == e.Position)
{
e.LabelContent = "";
}
} |
Note: The above workaround only works with an un-zoomed state of the chart, are you expecting the same behavior on the zoom state also? Please let us know, we will check for the possibilities.
We hope the above solution will resolve your problem.
Regards,
Saravanan.
SS
Seitron spa
September 11, 2020 02:26 PM UTC
Hi,
for the moment I'm using the zoom, as you can see in my first message it is set to MaximumZoomLevel="4".
Otherwise I will implement the workaround, my app users probably don't use very often the zoom...
Bye,
Vito
YP
Yuvaraj Palanisamy
Syncfusion Team
September 14, 2020 02:21 PM UTC
We have analyzed your query and we suggest that to use EdgeLabelVisibilityMode becomes AlwaysVisible for DateTimeAxis Zoom in state.
The visibility of the edge labels in an axis can be controlled using EdgeLabelsVisibilityMode property.
The following options are available in EdgeLabelsVisibilityMode,
The following options are available in EdgeLabelsVisibilityMode,
· Visible - used to display the edge labels (first and last label) irrespective of the auto interval calculation until zooming (i.e., in normal state).
|
<chart:SfChart.PrimaryAxis>
<chart:DateTimeAxis EdgeLabelsVisibilityMode="AlwaysVisible" />
</chart:SfChart.PrimaryAxis>
|
Please let us know if you have any concern.
Regards,
Yuvaraj
SIGN IN To post a reply.
- 5 Replies
- 3 Participants
-
SS Seitron spa
- Sep 7, 2020 02:29 PM UTC
- Sep 14, 2020 02:21 PM UTC