Print Preview / Series Marks problem

TeeChart for ActiveX, COM and ASP
Post Reply
stewart
Newbie
Newbie
Posts: 7
Joined: Fri Nov 15, 2002 12:00 am
Location: Exeter, England
Contact:

Print Preview / Series Marks problem

Post by stewart » Thu Dec 18, 2003 10:35 am

When i print a chart it comes out OK, with the series marks showing the y axis values as expected. But when i do a print preview, the chart shows the x axis values instead! All i'm doing is either:

TCHart.Printer.PrintChart

or

TCHart.Printer.Preview

Pep
Site Admin
Site Admin
Posts: 3279
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Thu Dec 18, 2003 9:10 pm

>TCHart.Printer.Preview
Do you mean TChart.Printer.ShowPreview ?

Which TeeChart version are you using ?
I've test it here using the latest TeeChart Pro v6.04 and works as expected. Could you please attach the code that you are using ?

Josep Lluis Jorge
http://support.steema.com

stewart
Newbie
Newbie
Posts: 7
Joined: Fri Nov 15, 2002 12:00 am
Location: Exeter, England
Contact:

Post by stewart » Fri Dec 19, 2003 8:53 am

Yes - TChart1.Printer.ShowPreview

I'm using TChart v5.0.3.1 - I'm aware there is an update but previews have worked OK before - there have been some code changes but nothing that should affect print preview.


Code snippets:

With TChart1

.Legend.Visible = False

.Axis.Bottom.Labels.OnAxis = False
.Axis.Bottom.Labels.Angle = 90

'Clear any existing series
.RemoveAllSeries

'Add the single series for these charts
.AddSeries scBar3D

.Series(0).Marks.Visible = True

Dim FirstReading As Integer
FirstReading = 0
Do While HourlyTotals(FirstReading) = 0
FirstReading = FirstReading + 1
Loop

Dim LastReading As Integer
LastReading = 23
Do While HourlyTotals(LastReading) = 0
LastReading = LastReading - 1
Loop

Dim TimeFrom As String
Dim TimeTo As String
TimeFrom = GetSetting(App.ProductName, "Settings", "Start of Day", Format(Now, "dd-mmm-yyyy") & " 08:00")
TimeTo = GetSetting(App.ProductName, "Settings", "End of Day", Format(Now, "dd-mmm-yyyy") & " 18:00")


For i = CInt(Left(TimeFrom, 2)) To CInt(Left(TimeTo, 2)) 'FirstReading To LastReading
Dim Time1 As String
Dim Time2 As String
Time1 = CStr(i) & ":00"
Time2 = CStr(i) & ":59"
If Len(CStr(i)) = 1 Then
Time1 = "0" & Time1
Time2 = "0" & Time2
End If


Select Case chartType

Case E_DAILY_SUMMARY
.Series(0).Add CDbl(HourlyTotals(i) / 60), Time1 & " - " & Time2, vbRed

Case E_CALLS_PER_HOUR
.Series(0).Add CDbl(HourlyTotals(i)), Time1 & " - " & Time2, vbRed

Case E_CALL_DURATIONS
.Series(0).Add CDbl(HourlyTotals(i) / 60), Time1 & " - " & Time2, vbRed


End Select

.Series(0).PointColor(.Series(0).Count - 1) = mmColourPicker.Value

Next i


End With

With TChart1
.Header.Text(0) = chartTitle & lblReportDate & " (" & m_UserName & ")"
.Axis.Bottom.Title.Caption = chartX
.Axis.Left.Title.Caption = chartY
.Header.Alignment = taCenter
.Axis.Bottom.TitleSize = 0
.Axis.Bottom.Title.Font.Size = 8
End With





The chart when Previewed, shows values like '09:00 - 09:59' for the series mark instead of the actual y value which is for example 21.75. When printed it comes out properly.

stewart
Newbie
Newbie
Posts: 7
Joined: Fri Nov 15, 2002 12:00 am
Location: Exeter, England
Contact:

Post by stewart » Fri Dec 19, 2003 10:29 am

Just upgraded to v 5.0.6.0 and problem still occurs.

stewart
Newbie
Newbie
Posts: 7
Joined: Fri Nov 15, 2002 12:00 am
Location: Exeter, England
Contact:

Post by stewart » Fri Dec 19, 2003 12:44 pm

Export also does this - i.e. call to TChart1.Export.ShowExport, save chart as BMP. Open BMP - the series marks are set to the x axis labels.

stewart
Newbie
Newbie
Posts: 7
Joined: Fri Nov 15, 2002 12:00 am
Location: Exeter, England
Contact:

Post by stewart » Fri Dec 19, 2003 3:39 pm

Its sorted now (i think :wink: ) - my series marks style was set to 'label' - and i didnt realise that adding points using:series(x).add value, str, vbRed was setting the label to 'str'.

i changed the mark style to 'value' and now OK.

Doesnt explain why on Print & screen display, that the values rather than the labels were used for the marks.

But i've got the charts working how i want them now so i'm happy!

Post Reply