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
Few Clarifications !!
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:
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:
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 ?
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 #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;
Marjan Slatinek,
http://www.steema.com
http://www.steema.com
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
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
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Satish,
You can address each of the series using it's SeriesIndex using Chart1[SeriesIndex].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 use Chart1[SeriesIndex].Free.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.
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.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.
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.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 !!
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |