We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

problem in my candle chart

Thread ID:

Created:

Updated:

Platform:

Replies:

68478 Sep 23,2007 12:18 AM Oct 6,2007 07:10 AM Windows Forms 1
loading
Tags: FAQ
zaw
Asked On September 23, 2007 12:18 AM

I have a problem with candle chart that do not show real info in chart as i inputted.

my input data is like that.
Open Min Max Close date
2.035 2.030 2.037 2.030 2007-07-31 23:59

pls reply me.


// This is my chart initialization.

protected void InitializeChart()
{
this.chartControl1.Indexed = true;

ChartSeries series = this.chartControl1.Model.NewSeries("Candle", ChartSeriesType.Candle);
series.Text = series.Name;

model = new ChartDataBindModel(this.prodDs1, "Market");
model.XName = "Date";
model.YNames = new String[] { "Max", "Open", "Min", "Close" };
series.SeriesModelImpl = model;
this.chartControl1.Series.Add(series);
this.chartControl1.PrimaryXAxis.ValueType = ChartValueType.DateTime;
this.chartControl1.PrimaryXAxis.DateTimeFormat = "dd/MM/yy hh";
this.chartControl1.PrimaryXAxis.DrawGrid = false;
this.chartControl1.PrimaryXAxis.RoundingPlaces = 12;
this.chartControl1.PrimaryXAxis.RangeType = ChartAxisRangeType.Set;
this.chartControl1.PrimaryXAxis.DateTimeRange = new ChartDateTimeRange(lastTime.AddMonths(-1).AddDays(-21), lastTime.AddMonths(-1).AddDays(-19), 8, ChartDateTimeIntervalType.Hours);
this.chartControl1.PrimaryXAxis.LabelIntersectAction = ChartLabelIntersectAction.Rotate;

this.chartControl1.PrimaryYAxis.RangeType = ChartAxisRangeType.Set;
this.chartControl1.PrimaryYAxis.Range.Min = 0;
this.chartControl1.PrimaryYAxis.Range.Max = 3;
this.chartControl1.PrimaryYAxis.Range.Interval = 0.5;
this.chartControl1.PrimaryYAxis.DrawGrid = false;
this.chartControl1.PrimaryYAxis.Title = "";
this.chartControl1.Text = "";

this.chartControl1.PrimaryYAxis.DrawGrid = false;

this.chartControl1.ColumnWidthMode = ChartColumnWidthMode.FixedWidthMode;
this.chartControl1.ColumnFixedWidth = 10;
}


Golda Rebecal [Syncfusion]
Replied On October 6, 2007 07:10 AM

Hi Zaw,

Sorry for the delay in responding.

You have to set y values in the order High, Low, Open and Close. Also you have to give proper datetime range for X axis in order to display the chart properly. I tested this issue by using the values given by you in the FinancialCharts demo sample and it worked fine.

Here is the modified code snippet I used to test this issue in FinancialCharts demo sample:
private void CreateDataSet()
{
........
..........
DataRow drEmpty = prodDs1.Tables[tableName].NewRow();
prodDs1.Tables[tableName].Rows.Add(drEmpty);
int count = Math.Max(0, prodDs1.Tables[tableName].Rows.Count - 1);
prodDs1.Tables[tableName].Rows[count]["Quantity"] = 2.037;
prodDs1.Tables[tableName].Rows[count]["Quantity1"] = 2.030;
prodDs1.Tables[tableName].Rows[count]["Quantity2"] = 2.035;
prodDs1.Tables[tableName].Rows[count]["Quantity3"] = 2.030;
prodDs1.Tables[tableName].Rows[count]["ExpiresDate"] = "2007-07-31 23:59";
}

protected void InitializeChartData()
{
ChartSeries series1 = this.chartControl1.Model.NewSeries(" Series 1",ChartSeriesType.Candle);
series1.Text = series1.Name;
ChartDataBindModel model = new ChartDataBindModel(this.prodDs1, "Products");
model.XName = "ExpiresDate";
model.YNames = new string[] { "Quantity", "Quantity1", "Quantity2", "Quantity3" };
series1.SeriesModelImpl = model;

this.chartControl1.Series.Add(series1);
this.chartControl1.Text="Stock Price Summary";
this.chartControl1.PrimaryYAxis.Title="Price $";
this.chartControl1.PrimaryXAxis.Title="Week Day";
this.chartControl1.PrimaryYAxis.RangeType = ChartAxisRangeType.Set;
this.chartControl1.PrimaryYAxis.Range.Min = 2;
this.chartControl1.PrimaryYAxis.Range.Max = 2.1;
this.chartControl1.PrimaryYAxis.Range.Interval = 0.1;

this.chartControl1.PrimaryXAxis.ValueType = ChartValueType.DateTime;
this.chartControl1.PrimaryXAxis.RangeType = ChartAxisRangeType.Set;
//this.chartControl1.PrimaryXAxis.DateTimeRange = new ChartDateTimeRange(lastTime.AddMonths(-1).AddDays(-21), lastTime.AddMonths(-1).AddDays(-19), 8, ChartDateTimeIntervalType.Hours);
this.chartControl1.PrimaryXAxis.DateTimeRange = new ChartDateTimeRange(DateTime.Parse("2007-07-29 23:59"), DateTime.Parse("2007-08-1 23:59"), 8, ChartDateTimeIntervalType.Hours);
this.chartControl1.PrimaryXAxis.LabelIntersectAction = ChartLabelIntersectAction.Rotate;
this.chartControl1.PrimaryXAxis.DateTimeFormat = "dd/MM/yy hh";
}

Please try this and let me know if this helps you.

We appreciate your interest in Syncfusion products.

Bes regards,
Golda

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;