Page 1 of 1

display not showing correctly

Posted: Wed Dec 18, 2013 1:24 am
by 16565592
Hello,

Please see attached chart I have included. I have the following questions:
1. The scroll bar is not at the end. How do I move it to the end i.e. far right?
2. The data is daily data but it is crunching everything up. How do I show 1 years of data per screen and then allow a scroll back?
3. Once I do number 2, is there an easy way to set the y-axis for the min./max prices instead of calculating each?

-Mike

Re: display not showing correctly

Posted: Thu Dec 19, 2013 11:58 am
by yeray
Hi Mike,
sunman4008 wrote:1. The scroll bar is not at the end. How do I move it to the end i.e. far right?
You can control the scroll bar manually setting it's Min, Max and Value properties. If you want it at the end, you just have to set Value=Max.
sunman4008 wrote:2. The data is daily data but it is crunching everything up. How do I show 1 years of data per screen and then allow a scroll back?
You can use the pagination feature or to manually control the bottom axis Minimum and Maximum properties. See the Tutorial 3 - Chart Paging and Tutorial 4 - Axis Control.
You can use the ScrollBar Change event to call the Page.Next/Page.Previous (if you go for the pagination) or the Axis.Bottom.SetMinMax (if you go for the manual control of the bottom axis) functions.
sunman4008 wrote:3. Once I do number 2, is there an easy way to set the y-axis for the min./max prices instead of calculating each?
If you want to fix the left axis to the absolute minimum and maximum values in your series, you can just let the chart to calculate it for you (forcing a repaint before changing any axis scale) and set the left axis Automatic property to False so it won't be further recalculated.

Code: Select all

Private Sub Form_Load()
  TChart1.Aspect.View3D = False
  TChart1.Legend.Visible = False

  TChart1.AddSeries scCandle
  TChart1.Series(0).FillSampleValues 1000
  
  TChart1.Environment.InternalRepaint
  TChart1.Axis.Left.Automatic = False
  
  HScroll1.Max = Year(TChart1.Series(0).XValues.Maximum)
  HScroll1.Min = Year(TChart1.Series(0).XValues.Minimum)
  HScroll1.Value = HScroll1.Max
End Sub

Private Sub HScroll1_Change()
  TChart1.Axis.Bottom.SetMinMax CDate("1/1/" + Str$(HScroll1.Value)), CDate("31/12/" + Str$(HScroll1.Value))
End Sub