Few Clarifications !!

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Satish
Newbie
Newbie
Posts: 37
Joined: Fri Mar 04, 2005 5:00 am

Few Clarifications !!

Post by Satish » Mon Mar 21, 2005 1:27 pm

I need help with the following queries:-


1. Is there a limit to the number of series that can be attached to a chart ? Series1 display disappears at times when new series are added !!

2. How does one get the Y-Axis scale to display on the right hand side both for the Main Axis and the Custom Axes ?

3. How does one convert a Y-value scale reading such as 1,500,000 to display as 1.5m ?

4. Where do I customize the spacing of grid lines ?

5. How can one add and free financial functions dynamically (in code) ?


Will appreciate exact syntax/pointers to code in the sample programs or on the forum.

Regards,

Satish

Marjan
Site Admin
Site Admin
Posts: 745
Joined: Fri Nov 07, 2003 5:00 am
Location: Slovenia
Contact:

Post by Marjan » Mon Mar 21, 2005 2:26 pm

Hi.

Re #1 : Maximum is set to 134,217,727 points per Series and same for Series per Chart. Practically speaking, trying to load that many points into a Series is an issue normally limited by machine RAM. Just how do you add new series to chart ? Are they of the same type ?

Re #2 : By using the TChartAxis.OtherSide property. Example:

Code: Select all

Chart1.CustomAxes.Items[0].OtherSide := True;
Re #3 : Several ways to do it, the easiest is to use TChart.OnGetAxisLabel event to transform individual axis labels. I believe there is an example of this feature included with TeeChart demo. Check the "All features -> Tools -> Axis labels" example.

Re #4 : Either by using TChart OnGetAxisLabel or OnGetNextAxisLabel events OR by manually adding custom axis labels at specific coordinates. As a last resort you can also manually draw required gridlines directly on chart Canvas in it's OnAfterDraw event.

Re #5 : You can use the same approach as with any other function type. Here is an example for RSIFunction:

Code: Select all

  Chart1.FreeAllSeries(nil);
  // add source series - in this example
  // candle series and populate it with data
  Chart1.AddSeries(TCandleSeries);
  Chart1.Series[0].FillSampleValues(20);

  // Add another (line) series, used by the RSI function
  Chart1.AddSeries(TLineSeries);
  Chart1.Series[1].SetFunction(TRsiFunction.Create(Self));
  // connect function series to datasource:
  // in this case to first series
  Chart1.Series[1].DataSource := Chart1.Series[0];
  // Set additional RSI function properties:
  With (Chart1.Series[1].FunctionType as TRSIFunction) do
  begin
    Style := rsiOpenClose;
    Period := 5;
  end;
  // finally, force function to recreate values from first series
  Chart1.Series[1].CheckDataSource;
As for freeing, it all depends if you want to free only function (and leave the function series as it is) or if you want to free series and associated function. Which approach are you thinking about ?
Marjan Slatinek,
http://www.steema.com

Satish
Newbie
Newbie
Posts: 37
Joined: Fri Mar 04, 2005 5:00 am

Post by Satish » Tue Mar 22, 2005 2:28 am

Thanks a lot for the code samples - I will work on these.

Satsih

Satish
Newbie
Newbie
Posts: 37
Joined: Fri Mar 04, 2005 5:00 am

Post by Satish » Mon Apr 04, 2005 1:44 am

Marjan,

The code stub you sent for functions works beautifully for EMA, RSI & Stochastic functions. I need additional help for the following:-

1. Coding of ADX, MACD & Bollinger functions - the problem that I see is that each one of them has multiple underlying series. How do I handle this ? I need to access the data for each of the functions, for example for ADX I need ADX, +DI & -DI data.

2. How do I release a function series and also disassociate the function from the series. Might have to resort to this approach if I run into memory issues.

3. Is there any way to feed TChartGrid with data in reverse chronological order ? Stocks data needs to be put in reverse chronological order to have more focus on the latest data.

4. Also is there a way to align Price data (TCandleSeries) with RSI 10 days data. For 10 days RSI, RSI data has 9 entries less in it's series than TCandleSeries. Is there a easy way to align this by date ? Right now I am resorting to creating a customized string grid to handle this !!

Will appreciate some code stubs/ideas for the above issues.

Regards,

Satish

Satish
Newbie
Newbie
Posts: 37
Joined: Fri Mar 04, 2005 5:00 am

Post by Satish » Wed Apr 06, 2005 12:34 pm

Any ideas/updates ? Will appreciate help.

Satish

Satish
Newbie
Newbie
Posts: 37
Joined: Fri Mar 04, 2005 5:00 am

Post by Satish » Fri Apr 08, 2005 12:33 pm

Help please - it has been a couple of days now !!

Satish

Satish
Newbie
Newbie
Posts: 37
Joined: Fri Mar 04, 2005 5:00 am

Post by Satish » Tue Apr 12, 2005 6:10 pm

Marjan/Narcis,

Could somebody please help me out with the additional queries in this post ? Somehow this post has escaped your attention.

Regards,

Satish

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed Apr 13, 2005 10:37 am

Hi Satish,
1. Coding of ADX, MACD & Bollinger functions - the problem that I see is that each one of them has multiple underlying series. How do I handle this ? I need to access the data for each of the functions, for example for ADX I need ADX, +DI & -DI data.
You can address each of the series using it's SeriesIndex using Chart1[SeriesIndex].
2. How do I release a function series and also disassociate the function from the series. Might have to resort to this approach if I run into memory issues.
You can use Chart1[SeriesIndex].Free.
3. Is there any way to feed TChartGrid with data in reverse chronological order ? Stocks data needs to be put in reverse chronological order to have more focus on the latest data.
I'm afraid not. You can sort XValues but will be also sorted on the chart. A solution would be using a string grid and populating the chart with this information as you can see in the "Grid To Chart" example at the TeeChart features demo.
4. Also is there a way to align Price data (TCandleSeries) with RSI 10 days data. For 10 days RSI, RSI data has 9 entries less in it's series than TCandleSeries. Is there a easy way to align this by date ? Right now I am resorting to creating a customized string grid to handle this !!
Yes, you are right, this is a deffect an have included it to our bug list to be fixed for future releases. By now the solutions is using a string grid.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply