Problem with OWC Chart TickLabels

V

Vijay

I see a strange problem with OWC chart component. Whenever
the chart bottom axis has more than 500 points the tick
labels appear in vertical single line. If there any fix
for it?

Thanks,
Vijay

Environment:
Win 2000, VB 6.0, OWC 9.0
 
T

Thao Moua [ms]

Can you be more specific about the 'vertical single line'
statement. Do you mean you only see one vertical line or
all the ticks appear as vertical?

-tm
 
V

Vijay

to be specific to the problem - I could not paste the
image so here is the vb code which generates the problem.

Open a new VB 6.0 project. Add reference to OWC 9.0
components. On the form drop the following controls -
OWC.spreadsheet, owc.chartspace, command button, text box.
and run the app. In form code paste the below code. Click
plot. You will see the problem. Now change the value in
text box to 400 and click plot again.

'**********
Option Explicit

Dim oChart As WCChart

Dim MAXTICKS As Integer


Private Sub PlotGraph()
On Error GoTo ErrTrap
Dim oSeries As WCSeries

For Each oSeries In oChart.SeriesCollection
oChart.SeriesCollection.Delete oSeries.Index
Next

oChart.Axes(chAxisPositionBottom).HasMajorGridlines =
True
oChart.Axes(chAxisPositionBottom).MajorUnit = 66
oChart.Axes(chAxisPositionBottom).TickLabelSpacing = 66
oChart.Axes(chAxisPositionBottom).HasMinorGridlines = -
False

Set oSeries = oChart.SeriesCollection.Add
With oSeries
.SetData chDimCategories, 0, "A1:A" & MAXTICKS
.SetData chDimValues, 0, "B1:B" & MAXTICKS
.Scalings(chDimValues).HasAutoMaximum = False
.Scalings(chDimValues).Minimum = 1
.Scalings(chDimValues).Maximum = 33
.Line.Weight = 2
.Marker.Size = 0
.Caption = "Price"
End With
Exit Sub
Resume
ErrTrap:
MsgBox Err.Description
End Sub

Private Sub Command1_Click()
Dim d As Integer
Dim i As Integer

MAXTICKS = Val(Text1)

d = 1
For i = 1 To MAXTICKS
Spreadsheet1.Cells(i, 1) = "[2/" & d & "]"
Spreadsheet1.Cells(i, 2) = Int(2 * Rnd + d)
If (i Mod 33) = 0 Then d = d + 1
Next

PlotGraph
End Sub


Private Sub Form_Load()
Command1.Caption = "Plot"

With Me
.Top = 1320
.Left = 1320
.Width = 10215
.Height = 9495
End With
With ChartSpace1
.Top = 120
.Left = 120
.Width = 8655
.Height = 5775
End With

With Spreadsheet1
.Top = 6000
.Left = 120
.Width = 8655
.Height = 2895
End With
With Command1
.Top = 120
.Left = 9000
.Width = 1095
.Height = 375
End With

With Text1
.Top = 600
.Left = 9000
.Width = 1000
.Height = 315
.Text = 500
End With

Set ChartSpace1.DataSource = Spreadsheet1
Set oChart = ChartSpace1.Charts.Add
oChart.HasTitle = True
oChart.Title.Caption = "Stock Price"
oChart.Type = chChartTypeLineMarkers
oChart.HasLegend = True


End Sub
'********************************************

Thanks,
VJ
 
T

Thao Moua [ms]

I see the problem. There is not much you can do about it
in OWC9. In OWC9 Chart tries to space and layout the
category labels even if it looks correct at the UI
level. In OWC10 we allowed more control to the user to
manipulate the axis.

-tm
-----Original Message-----
to be specific to the problem - I could not paste the
image so here is the vb code which generates the problem.

Open a new VB 6.0 project. Add reference to OWC 9.0
components. On the form drop the following controls -
OWC.spreadsheet, owc.chartspace, command button, text box.
and run the app. In form code paste the below code. Click
plot. You will see the problem. Now change the value in
text box to 400 and click plot again.

'**********
Option Explicit

Dim oChart As WCChart

Dim MAXTICKS As Integer


Private Sub PlotGraph()
On Error GoTo ErrTrap
Dim oSeries As WCSeries

For Each oSeries In oChart.SeriesCollection
oChart.SeriesCollection.Delete oSeries.Index
Next

oChart.Axes(chAxisPositionBottom).HasMajorGridlines =
True
oChart.Axes(chAxisPositionBottom).MajorUnit = 66
oChart.Axes(chAxisPositionBottom).TickLabelSpacing = 66
oChart.Axes(chAxisPositionBottom).HasMinorGridlines = -
False

Set oSeries = oChart.SeriesCollection.Add
With oSeries
.SetData chDimCategories, 0, "A1:A" & MAXTICKS
.SetData chDimValues, 0, "B1:B" & MAXTICKS
.Scalings(chDimValues).HasAutoMaximum = False
.Scalings(chDimValues).Minimum = 1
.Scalings(chDimValues).Maximum = 33
.Line.Weight = 2
.Marker.Size = 0
.Caption = "Price"
End With
Exit Sub
Resume
ErrTrap:
MsgBox Err.Description
End Sub

Private Sub Command1_Click()
Dim d As Integer
Dim i As Integer

MAXTICKS = Val(Text1)

d = 1
For i = 1 To MAXTICKS
Spreadsheet1.Cells(i, 1) = "[2/" & d & "]"
Spreadsheet1.Cells(i, 2) = Int(2 * Rnd + d)
If (i Mod 33) = 0 Then d = d + 1
Next

PlotGraph
End Sub


Private Sub Form_Load()
Command1.Caption = "Plot"

With Me
.Top = 1320
.Left = 1320
.Width = 10215
.Height = 9495
End With
With ChartSpace1
.Top = 120
.Left = 120
.Width = 8655
.Height = 5775
End With

With Spreadsheet1
.Top = 6000
.Left = 120
.Width = 8655
.Height = 2895
End With
With Command1
.Top = 120
.Left = 9000
.Width = 1095
.Height = 375
End With

With Text1
.Top = 600
.Left = 9000
.Width = 1000
.Height = 315
.Text = 500
End With

Set ChartSpace1.DataSource = Spreadsheet1
Set oChart = ChartSpace1.Charts.Add
oChart.HasTitle = True
oChart.Title.Caption = "Stock Price"
oChart.Type = chChartTypeLineMarkers
oChart.HasLegend = True


End Sub
'********************************************

Thanks,
VJ
-----Original Message-----
Can you be more specific about the 'vertical single line'
statement. Do you mean you only see one vertical line or
all the ticks appear as vertical?

-tm

.
.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top