Skip to content

Commit

Permalink
WindowsForms graph
Browse files Browse the repository at this point in the history
  • Loading branch information
Aliuser11 committed Nov 30, 2024
1 parent 0dc4dab commit 94bfe57
Show file tree
Hide file tree
Showing 10 changed files with 13,583 additions and 19 deletions.
6 changes: 6 additions & 0 deletions Financial_Candlestick_Patterns.sln
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Examples_Formations", "Exam
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Examples_Patterns", "Examples_Patterns\Examples_Patterns.csproj", "{23135CD8-163D-4C86-8017-1036D76F5C0D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GraphCreator", "GraphCreator\GraphCreator.csproj", "{D100D9CC-005D-4220-AEA2-63D008FA8A28}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -39,6 +41,10 @@ Global
{23135CD8-163D-4C86-8017-1036D76F5C0D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{23135CD8-163D-4C86-8017-1036D76F5C0D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{23135CD8-163D-4C86-8017-1036D76F5C0D}.Release|Any CPU.Build.0 = Release|Any CPU
{D100D9CC-005D-4220-AEA2-63D008FA8A28}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D100D9CC-005D-4220-AEA2-63D008FA8A28}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D100D9CC-005D-4220-AEA2-63D008FA8A28}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D100D9CC-005D-4220-AEA2-63D008FA8A28}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
39 changes: 39 additions & 0 deletions GraphCreator/Form1.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions GraphCreator/Form1.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace GraphCreator
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
}
}
120 changes: 120 additions & 0 deletions GraphCreator/Form1.resx
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
20 changes: 20 additions & 0 deletions GraphCreator/GraphCreator.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">

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

<ItemGroup>
<PackageReference Include="WinForms.DataVisualization" Version="1.9.2" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Candlestick_Patterns\Candlestick_Patterns.csproj" />
<ProjectReference Include="..\GraphMaker\GraphMaker.csproj" />
</ItemGroup>

</Project>
121 changes: 121 additions & 0 deletions GraphCreator/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
using Candlestick_Patterns;
using System.Windows.Forms.DataVisualization.Charting;
using GraphMaker;

namespace Dino.Tools.WebMonitor
{
public class Graph : Form
{
private System.ComponentModel.IContainer components = null;
System.Windows.Forms.DataVisualization.Charting.Chart chart1;

IFiboTester _fiboTester = new FiboTester();

[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Graph());
}
public Graph()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{
chart1.Series.Clear();
var series1 = new System.Windows.Forms.DataVisualization.Charting.Series
{
Name = "graph",
Color = System.Drawing.Color.Green,
IsVisibleInLegend = false,
IsXValueIndexed = true,
ChartType = SeriesChartType.Line
};

this.chart1.Series.Add(series1);

var patternName = "BullishButterfly";
//var points = GetGraphData(patternName);
var points = new List<ZigZagObject>()
{
new ZigZagObject() {Close = 2.5M, Signal = false},
new ZigZagObject() {Close = 3.5M, Signal = true},
new ZigZagObject() {Close = 4.5M, Signal = true},
new ZigZagObject() {Close = 4.5M, Signal = false} ,
};

for (int i = 0; i < points.Count; i++)
{
var item = points[i];
series1.Points.AddXY(i, item.Close);
if (item.Signal == true)
{
series1.Points[i].MarkerStyle = MarkerStyle.Triangle;
series1.Points[i].MarkerSize = 5;
series1.Points[i].MarkerColor = Color.Red;
}
}

chart1.Invalidate();
}

private List<ZigZagObject> GetGraphData(string patternName)
{
return _fiboTester.GetGraphData(patternName);
}

protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}

private void InitializeComponent()
{
ChartArea chartArea1 = new ChartArea();
Legend legend1 = new Legend();
chart1 = new Chart();
((System.ComponentModel.ISupportInitialize)chart1).BeginInit();
SuspendLayout();
//
// chart1
//
chartArea1.Name = "ChartArea1";
chart1.ChartAreas.Add(chartArea1);
chart1.Dock = DockStyle.Fill;
legend1.Name = "Legend1";
chart1.Legends.Add(legend1);
chart1.Location = new Point(0, 0);
chart1.Margin = new Padding(4, 5, 4, 5);
chart1.Name = "chart1";
chart1.Size = new Size(379, 403);
chart1.TabIndex = 0;
chart1.Text = "chart1";
chart1.Click += chart1_Click;
//
// Graph
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(379, 403);
Controls.Add(chart1);
Margin = new Padding(4, 5, 4, 5);
Name = "Graph";
Text = "Graph";
Load += Form1_Load;
((System.ComponentModel.ISupportInitialize)chart1).EndInit();
ResumeLayout(false);
}

private void chart1_Click(object sender, EventArgs e)
{

}
}
}
Loading

0 comments on commit 94bfe57

Please sign in to comment.