Strange behave with OWC11 on Excel

406 views Asked by At

Using Excel VBA I created a chart, using OWC11, on an userform. Through code I copy 2 columns from a worksheet to the OWC chart spreadsheet.

1st column is dates (for x-axis), 2nd is values (numbers)(for y-axix).

My problem is that when on spreadsheet the 1st column has a format of serial dates, the y-axis on the chart shows the values correctly. But x-axis shows serial dates.

If I set 1st column format as Date, long, short or whatever, the y-axis changes scale and values, only on the chart, are totally different than the spreadsheet and worksheet, which are ok. these values are a lot bigger than the source.

I already tried different ways to copy from worksheet to owc spreadsheet but no way. It looks to me the issue is on the way the spreadsheet sends data to the chart.

Please do you have any idea what is causing this strange behave?

My software enviroment is as follow:

  1. Windows Vista
  2. Excel professional 2010
  3. OWC11 (Ver. 12.0.0.4518)

here's my code.

Dim ChtSpc As OWC11.ChartSpace
Dim cht As OWC11.ChChart
Dim Sps As OWC11.Spreadsheet
Dim ws As Worksheet

Set ChtSpc = Me.ChartSpace1
Set Sps = Me.Spreadsheet1
Set ws = ThisWorkbook.Worksheets("foglio3")

Sps.Range("A1:c50") = ws.Range("A1:c50").Value
Set ChtSpc.DataSource = Sps
Set cht = ChtSpc.Charts.Add

With cht
    .SetData chDimCategories, 0, "A1:A50"
    .SeriesCollection(0).SetData chDimValues, 0, "B1:B50"
    .HasLegend = True
    .SeriesCollection.Add
    .SeriesCollection(1).SetData chDimValues, 0, "c1:c50"
    .HasTitle = True
    .Title.Caption = "ANDAMENTO"
    .Title.Interior.Color = 1677215
    .Type = chChartTypeLine
End With
ChtSpc.Interior.SetTwoColorGradient chGradientFromCenter, chGradientVariantEnd, 9125192, 16777215
End Sub
0

There are 0 answers