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

Message ListMessage List     Post MessagePost Message

  Decimal data types in setData
Posted by Maurizio Porro on Dec-14-2018 07:33
in a candlestick chart when I use

c.setData(timeStamps, highData, lowData, openData, closeData, volData, extraDays)

to manage real data parsed from a csv file from Yahoo Finance, I saw the type of data available for open, high, low, close are double[].
But how I can manage the data if they are decimal (1.34 ecc. ecc.) ??
I mean

double[] timeStamps = new double[noOfDays + 1];
decimal[] highData = new decimal[noOfDays + 1];
decimal[] lowData = new decimal[noOfDays + 1];
decimal[] openData = new decimal[noOfDays + 1];
decimal[] closeData = new decimal[noOfDays + 1];
double[] volData = new double[noOfDays + 1];

Thank you for the support.

  Re: Decimal data types in setData
Posted by Peter Kwan on Dec-14-2018 15:39
Hi Maurizio,

From my understanding, a CSV file is a text file, so all the data are text strings. A text string can look like a number in human language, but a text string is not a number in programming language. For example, in C#, a text string in C# is of type "string", while a number can be of type "int", "double", etc..

To plot a chart, numbers are needed. You can parse the text strings into numbers using the methods of your programming language. For example, in C#, you can use Double.Parse or Double.TryParse to convert the text string into a number. See:

In Java, you can use Double.parseDouble

Hope this can help.

Peter Kwan