Skip to content

Updated the sample #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,19 @@ WPF SfChart provides support for formatting axis labels based on axis intervals

![Output](https://user-images.githubusercontent.com/105482474/211509266-b28301df-9f64-4c2b-8f79-e9cf258b2723.png)

## Troubleshooting

#### Path too long exception

If you are facing a path too long exception when building this example project, close Visual Studio and rename the repository to a shorter name before building the project.

For more details, refer to the KB on [How to format TimeSpanAxis label based on axis interval in WPF (SfChart)](https://support.syncfusion.com/kb/article/12317/how-to-format-timespanaxis-label-based-on-axis-interval-in-wpf-sfchart).


##See Also

[Axis labels for TimeSpanAxis in WPF (SfChart)](https://help.syncfusion.com/wpf/charts/axis#axis-labels)

[How to display the axis labels in a particular format](https://www.syncfusion.com/kb/3318/how-to-display-the-axis-labels-in-a-particular-format-of-wpf-chart-sfchart)

[How to customize label formats of data-time axis during the interval transitions](https://www.syncfusion.com/kb/6940/how-to-customize-the-label-formats-of-date-time-axis-during-interval-transitions-in-wpf)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@KompelliSravanSyncfusion why removed it?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@VimalaThirumalaiKumarSF3739 , It was removed by mistake by aligning the content. Now it was added.


[How to customize label formats of data-time axis during the interval transitions](https://www.syncfusion.com/kb/6940/how-to-customize-the-label-formats-of-date-time-axis-during-interval-transitions-in-wpf)
4 changes: 2 additions & 2 deletions TimeSpanAxis/TimeSpanAxis/App.xaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Application x:Class="TimeSpanAxis_Sample.App"
<Application x:Class="TimeSpanAxis.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:TimeSpanAxis_Sample"
xmlns:local="clr-namespace:TimeSpanAxis"
StartupUri="MainWindow.xaml">
<Application.Resources>

Expand Down
9 changes: 3 additions & 6 deletions TimeSpanAxis/TimeSpanAxis/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;

namespace TimeSpanAxis_Sample
namespace TimeSpanAxis
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}

}
12 changes: 6 additions & 6 deletions TimeSpanAxis/TimeSpanAxis/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using System.Windows;

[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
14 changes: 14 additions & 0 deletions TimeSpanAxis/TimeSpanAxis/DataPoint.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TimeSpanAxis
{
public class DataPoint
{
public TimeSpan Time { get; set; }
public double Distance { get; set; }
}
}
3 changes: 2 additions & 1 deletion TimeSpanAxis/TimeSpanAxis/TimeSpanAxis.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<TargetFramework>net8.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UseWPF>true</UseWPF>
</PropertyGroup>

Expand Down
27 changes: 27 additions & 0 deletions TimeSpanAxis/TimeSpanAxis/ViewModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TimeSpanAxis
{
public class ViewModel
{
public ObservableCollection<DataPoint> Data { get; set; }

public ViewModel()
{
Data = new ObservableCollection<DataPoint>
{
new DataPoint { Time = new TimeSpan(0, 0, 0, 0, 0), Distance = 50 },
new DataPoint { Time = new TimeSpan(0, 0, 0, 2), Distance = 100 },
new DataPoint { Time = new TimeSpan(0, 0, 0, 4), Distance = 200 },
new DataPoint { Time = new TimeSpan(0, 0, 0, 6), Distance = 350 },
new DataPoint { Time = new TimeSpan(0, 0, 0, 8), Distance = 500 },
new DataPoint { Time = new TimeSpan(0, 0, 0, 10), Distance = 650 }
};
}
}
}