ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  finance chart
Posted by Mohamed Wahab on Nov-15-2012 22:37
HELLO

we use your chart and we didn't know control time with our data
we insert time as format "yyyyy,MM,dd"
and chart not control time

we use this chart

http://www.advsofteng.com/gallery_finance.html
-------------------------------------------------
our code
=======

List<double> timeStampsx = new List<double>();
        List<double> highDatax = new List<double>();
        List<double> lowDatax = new List<double>();
        List<double> openDatax = new List<double>();
        List<double> closeDatax = new List<double>();
        List<double> volDatax = new List<double>();

        for (int i = 0; i < x ; i++)
        {
            DateTime res;
            DateTime.TryParse(ds.Tables["Chart"].Rows[i]["dt"].ToString(), out res);

            timeStampsx.Add(Convert.ToDouble(res.ToString("mmmdyyyy")));
            highDatax.Add(Convert.ToDouble(ds.Tables["Chart"].Rows[i]["hi"]));
            lowDatax.Add(Convert.ToDouble(ds.Tables["Chart"].Rows[i]["lo"]));
            openDatax.Add(Convert.ToDouble(ds.Tables["Chart"].Rows[i]["op"]));
            closeDatax.Add(Convert.ToDouble(ds.Tables["Chart"].Rows[i]["cl"]));
            volDatax.Add(Convert.ToDouble(ds.Tables["Chart"].Rows[i]["vol"]));

        }

        double[] timeStamps = timeStampsx.ToArray();
        double[] highData = highDatax.ToArray();
        double[] lowData = lowDatax.ToArray();
        double[] openData = openDatax.ToArray();
        double[] closeData = closeDatax.ToArray();
        double[] volData = volDatax.ToArray();

        FinanceChart c = new FinanceChart(720);

        c.setSize(300,100);
        // Add a title to the chart
        c.addTitle("("+TK +")"+" "+ NM);

        // Disable default legend box, as we are using dynamic legend
        c.setLegendStyle("normal", 8, Chart.Transparent, Chart.Transparent);

        // Set the data into the finance chart object
        c.setData(timeStamps, highData, lowData, openData, closeData, volData,
extraDays);

  Re: finance chart
Posted by Peter Kwan on Nov-16-2012 01:38
Hi Mohamed,

In ChartDirector, the date/time should be represented using your programming language. For example, in .NET, date/time should be represented as System.DateTime objects, not a text string in "yyyy,MM.dd" or any other format. So the code should be:

List<DateTime> timeStampsx = new List<DateTime>();

timeStampsx.Add(res);

and

DateTime[] timeStamps = timeStampsx.ToArray();

Hope this can help.

Regards
Peter Kwan