Gallery
JS Finance Support Resistance
<%@ Page Language="C#" Description="dotnetCHARTING Component"%>
<%@ Register TagPrefix="dotnet" Namespace="dotnetCHARTING" Assembly="dotnetCHARTING"%>
<%@ Import Namespace="System.Drawing" %>
<script runat="server">
void Page_Load(Object sender,EventArgs e)
{
// Demonstrates a finance candlestick chart with support/resistance axis markers.
chart.JS.Enabled = true;
// Add some axis markers.
AxisMarker resistance = new AxisMarker("Resistance", Color.Red,2900);
resistance.Label.LineAlignment = StringAlignment.Near;
resistance.LegendEntry.Visible = false;
resistance.Line.Width = 2;
chart.YAxis.Markers.Add(resistance);
AxisMarker support = new AxisMarker("support", Color.Orange,2650);
support.Label.LineAlignment = StringAlignment.Far;
support.LegendEntry.Name = "Support/Resistance";
support.Line.Width = 2;
chart.YAxis.Markers.Add(support);
// Set the title.
chart.Title="Financial Chart";
// Set 3D
chart.Use3D = true;
// Set the financial chart type
chart.DefaultSeries.Type = SeriesTypeFinancial.CandleStick;
// Set the legend template
chart.LegendBox.Template = "IconName";
chart.LegendBox.Position = LegendBoxPosition.ChartArea;
chart.LegendBox.Orientation = dotnetCHARTING.Orientation.TopLeft;
// Set the directory where the images will be stored.
chart.TempDirectory="temp";
// Set the format
chart.XAxis.FormatString = "d";
// Set the time padding for the x axis.
chart.XAxis.TimePadding = new TimeSpan(5,0,0,0);
// Set he chart size.
chart.Width = 700;
chart.Height = 350;
chart.Palette = new Color[] { };//prevent setting Palette, use default JS Palette
//get data
DataEngine de = new DataEngine();
de.Data = "~/data/resources/snp6mo.csv";
de.DataFields = "Xvalue=Date,Open=Open,Close=Adj Close,High=High,Low=Low";
chart.SeriesCollection.Add(de.GetFinancialSeries());
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Gallery Sample</title></head>
<body>
<div align="center">
<dotnet:chart id="chart" runat="server"/>
</div>
</body>
</html>
<%@ Page Language="vb" Description="dotnetCHARTING Component"%>
<%@ Register TagPrefix="dotnet" Namespace="dotnetCHARTING" Assembly="dotnetCHARTING"%>
<%@ Import Namespace="System.Drawing" %>
<script runat="server">
Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
' Demonstrates a finance candlestick chart with support/resistance axis markers.
chart.JS.Enabled = True
' Add some axis markers.
Dim resistance As AxisMarker = New AxisMarker("Resistance", Color.Red,2900)
resistance.Label.LineAlignment = StringAlignment.Near
resistance.LegendEntry.Visible = False
resistance.Line.Width = 2
chart.YAxis.Markers.Add(resistance)
Dim support As AxisMarker = New AxisMarker("support", Color.Orange,2650)
support.Label.LineAlignment = StringAlignment.Far
support.LegendEntry.Name = "Support/Resistance"
support.Line.Width = 2
chart.YAxis.Markers.Add(support)
' Set the title.
chart.Title="Financial Chart"
' Set 3D
chart.Use3D = True
' Set the financial chart type
chart.DefaultSeries.Type = SeriesTypeFinancial.CandleStick
' Set the legend template
chart.LegendBox.Template = "IconName"
chart.LegendBox.Position = LegendBoxPosition.ChartArea
chart.LegendBox.Orientation = dotnetCHARTING.Orientation.TopLeft
' Set the directory where the images will be stored.
chart.TempDirectory="temp"
' Set the format
chart.XAxis.FormatString = "d"
' Set the time padding for the x axis.
chart.XAxis.TimePadding = New TimeSpan(5,0,0,0)
' Set he chart size.
chart.Width = 700
chart.Height = 350
chart.Palette = New Color() { } 'prevent setting Palette, use default JS Palette
'get data
Dim de As DataEngine = New DataEngine()
de.Data = "~/data/resources/snp6mo.csv"
de.DataFields = "Xvalue=Date,Open=Open,Close=Adj Close,High=High,Low=Low"
chart.SeriesCollection.Add(de.GetFinancialSeries())
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Gallery Sample</title></head>
<body>
<div align="center">
<dotnet:chart id="chart" runat="server"/>
</div>
</body>
</html>
- Sample FilenameJsFinanceSupportResistance.aspx
- Version9.2
- Uses DatabaseNo