Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Changing DataLabels.Font.Size
Message
From
09/12/2003 10:07:55
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
09/12/2003 09:31:25
Stan Vaninger
Mitek Industries, Inc
Missouri, United States
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00857169
Message ID:
00857188
Views:
25
>I have been doing a lot of graphs during the past year using Excel Automation and have found the material in the 'MegaFox' book and 'MS Office Automation with VFP' to be very helpful. There is one thing that I have not been able to determine how to do: changing the font size for the Data Labels on a graph. I have some vertical bar graphs that have 20 or more bars and the data labels sometimes overlap to the point where they are unreadable.
>
>Thanks in advance,
>Stan

I think you already replied yourself :) .DataLabels.Font.Size = nValue.
ie:
lcXLS = Sys(5)+Curdir()+'exceldatalabeltest.xls'

Create Cursor SampleData (ItemName c(10), v1 i, v2 i, v3 i)
For ix=1 To 10
  Insert Into SampleData Values ;
    ('Item'+Transform(ix), Rand()*100, Rand()*100, Rand()*100 )
Endfor
Copy To (lcXLS) Type Xls

#include xlconstants.h
*** set the LOCALEID to English
nlLocaleId=Sys(3004)	&& Save local id
=Sys(3006,1033)		&& We will be sending instructions in English
oExcel = Crea('excel.application')
With oExcel
  .Visible = .T.
  .workbooks.Open(lcXLS)
  With .ActiveWorkBook.ActiveSheet
    oChartRange = .UsedRange
    .ChartObjects.Add(200, 10, 500, 500)
    With .ChartObjects(1).Chart
      .SetSourceData(oChartRange, xlColumns)
      .hastitle = .T.
      .haslegend = .T.
      .ChartTitle.Caption = "Chart Title"
      .ChartType = xlColumnClustered
      * Show labels with leader lines
      .ApplyDataLabels(xlDataLabelsShowValue)
      *Set label positions
      For Each oSeries In .SeriesCollection
        With oSeries
          .DataLabels.Orientation = xlUpward
          .DataLabels.Font.Size = .DataLabels.Font.Size - 4
          For Each oPoint In .Points
            With oPoint.DataLabel
              .Top = .Top - 20
            Endwith
            oPoint = .Null.
          Endfor
        Endwith
        oSeries = .Null.
      Endfor
    Endwith
  Endwith
  .Visible = .T.
Endwith
=Sys(3006,Val(nlLocaleId))
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform