Skip to content

Commit 787f57f

Browse files
Merge pull request #2 from SyncfusionExamples/RachelA07-patch-2
Add files via upload
2 parents 8d25de9 + 46561af commit 787f57f

15 files changed

+578
-0
lines changed

SQLWithChart/App.config

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<configuration>
3+
<startup>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" />
5+
</startup>
6+
</configuration>

SQLWithChart/App.xaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<Application x:Class="SQLWithChart.App"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:local="clr-namespace:SQLWithChart"
5+
StartupUri="MainWindow.xaml">
6+
<Application.Resources>
7+
8+
</Application.Resources>
9+
</Application>

SQLWithChart/App.xaml.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Configuration;
4+
using System.Data;
5+
using System.Linq;
6+
using System.Threading.Tasks;
7+
using System.Windows;
8+
9+
namespace SQLWithChart
10+
{
11+
/// <summary>
12+
/// Interaction logic for App.xaml
13+
/// </summary>
14+
public partial class App : Application
15+
{
16+
}
17+
}
2 MB
Binary file not shown.
3.06 MB
Binary file not shown.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[ViewState]
2+
Mode=
3+
Vid=
4+
FolderType=Generic

SQLWithChart/MainWindow.xaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<Window x:Class="SQLWithChart.MainWindow"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
5+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
6+
xmlns:local="clr-namespace:SQLWithChart"
7+
xmlns:chart="http://schemas.syncfusion.com/wpf"
8+
mc:Ignorable="d"
9+
Title="MainWindow" Height="450" Width="800">
10+
<Grid>
11+
12+
<Grid.DataContext>
13+
<local:ViewModel></local:ViewModel>
14+
</Grid.DataContext>
15+
16+
<chart:SfChart Margin="10">
17+
18+
<chart:SfChart.PrimaryAxis>
19+
<chart:NumericalAxis RangePadding="Additional" />
20+
</chart:SfChart.PrimaryAxis>
21+
22+
<chart:SfChart.SecondaryAxis>
23+
<chart:NumericalAxis RangePadding="Additional"/>
24+
</chart:SfChart.SecondaryAxis>
25+
26+
<chart:ScatterSeries ItemsSource="{Binding DataTable}"
27+
XBindingPath="xval"
28+
YBindingPath="yval"/>
29+
</chart:SfChart>
30+
31+
</Grid>
32+
</Window>

SQLWithChart/MainWindow.xaml.cs

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Data;
4+
using System.Data.SqlClient;
5+
using System.Linq;
6+
using System.Text;
7+
using System.Threading.Tasks;
8+
using System.Windows;
9+
using System.Windows.Controls;
10+
using System.Windows.Data;
11+
using System.Windows.Documents;
12+
using System.Windows.Input;
13+
using System.Windows.Media;
14+
using System.Windows.Media.Imaging;
15+
using System.Windows.Navigation;
16+
using System.Windows.Shapes;
17+
18+
namespace SQLWithChart
19+
{
20+
/// <summary>
21+
/// Interaction logic for MainWindow.xaml
22+
/// </summary>
23+
public partial class MainWindow : Window
24+
{
25+
public MainWindow()
26+
{
27+
InitializeComponent();
28+
}
29+
}
30+
31+
public class ViewModel
32+
{
33+
public ViewModel()
34+
{
35+
try
36+
{
37+
SqlConnection thisConnection = new SqlConnection(ConnectionString);
38+
thisConnection.Open();
39+
string Get_Data = "SELECT * FROM ChartData";
40+
SqlCommand cmd = thisConnection.CreateCommand();
41+
cmd.CommandText = Get_Data;
42+
SqlDataAdapter sda = new SqlDataAdapter(cmd);
43+
DataSet ds = new DataSet();
44+
sda.Fill(ds);
45+
var table = ds.Tables[0];
46+
this.DataTable = table;
47+
}
48+
catch
49+
{
50+
MessageBox.Show("DataBase Error");
51+
}
52+
}
53+
54+
public object DataTable { get; set; }
55+
56+
public static string ConnectionString
57+
{
58+
get
59+
{
60+
string currentDir = System.Environment.CurrentDirectory;
61+
currentDir = currentDir.Substring(0, currentDir.Length - 10) + "\\LocalDataBase";
62+
return @"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=" + currentDir + @"\SeriesItemsSource.mdf;Integrated Security=True";
63+
}
64+
}
65+
}
66+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
using System.Reflection;
2+
using System.Resources;
3+
using System.Runtime.CompilerServices;
4+
using System.Runtime.InteropServices;
5+
using System.Windows;
6+
7+
// General Information about an assembly is controlled through the following
8+
// set of attributes. Change these attribute values to modify the information
9+
// associated with an assembly.
10+
[assembly: AssemblyTitle("SQLWithChart")]
11+
[assembly: AssemblyDescription("")]
12+
[assembly: AssemblyConfiguration("")]
13+
[assembly: AssemblyCompany("")]
14+
[assembly: AssemblyProduct("SQLWithChart")]
15+
[assembly: AssemblyCopyright("Copyright © 2020")]
16+
[assembly: AssemblyTrademark("")]
17+
[assembly: AssemblyCulture("")]
18+
19+
// Setting ComVisible to false makes the types in this assembly not visible
20+
// to COM components. If you need to access a type in this assembly from
21+
// COM, set the ComVisible attribute to true on that type.
22+
[assembly: ComVisible(false)]
23+
24+
//In order to begin building localizable applications, set
25+
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
26+
//inside a <PropertyGroup>. For example, if you are using US english
27+
//in your source files, set the <UICulture> to en-US. Then uncomment
28+
//the NeutralResourceLanguage attribute below. Update the "en-US" in
29+
//the line below to match the UICulture setting in the project file.
30+
31+
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
32+
33+
34+
[assembly: ThemeInfo(
35+
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
36+
//(used if a resource is not found in the page,
37+
// or application resource dictionaries)
38+
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
39+
//(used if a resource is not found in the page,
40+
// app, or any theme specific resource dictionaries)
41+
)]
42+
43+
44+
// Version information for an assembly consists of the following four values:
45+
//
46+
// Major Version
47+
// Minor Version
48+
// Build Number
49+
// Revision
50+
//
51+
// You can specify all the values or you can default the Build and Revision Numbers
52+
// by using the '*' as shown below:
53+
// [assembly: AssemblyVersion("1.0.*")]
54+
[assembly: AssemblyVersion("1.0.0.0")]
55+
[assembly: AssemblyFileVersion("1.0.0.0")]

SQLWithChart/Properties/Resources.Designer.cs

Lines changed: 71 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)