Join The Works program to have access to the most current content, and to be able to ask questions and get answers from Revelation staff and the Revelation community

At 15 JAN 2020 05:29:41PM cmeyer wrote:

Until recently I have been using RFC routine to display charts but OWC11.EXE is no longer compatible with Microsoft V10. The routine used as below:

Is there an OI compatible replacement for displaying charts

TIA

Chris


Compile Subroutine Chart_Display(Control,Xparms,Yparms,Header,Legend,Type, Stacked, File)

/*

Uses Microsoft Office Web Components

see http://www.microsoft.com/downloads/details.aspx?

    familyid=7287252C-402E-4F72-97A5-E0FD290D4B76&displaylang=en



Usage: Create a window, add a bitmap, add a button which calls this function



12-07-2006 rjc Based on http://www.asp101.com/articles/chris/aspcharts/default.asp

Must install owc11.exe before this routine will work. This is found in c:\temp\microsoft\office OI chart interface directory

*/





Declare function GetTempPath, GetTempFilename, Unassigned



If Unassigned(Type) then Type = 'COLUMN'



$insert Logical

equ tab$ to \09\

equ eos$ to \00\



ChartSpace = OleCreateInstance("OWC11.ChartSpace")

x = ChartSpace->Clear()

c = ChartSpace->Constants



* Add a chart 

Charts = ChartSpace->Charts

Chart = Charts->Add()

Begin Case

	Case Type = 'LINE'

		If Stacked then

			Chart->Type = c->chChartTypeLineStacked

		end else

			Chart->Type = c->chChartTypeLine

		end

	Case Type = 'COLUMN'

		If Stacked then

			Chart->Type = c->chChartTypeColumnStacked

		end else

			Chart->Type = c->chChartTypeColumClustered

		end

	Case Type = 'PIE'

		If Stacked then

			Chart->Type = c->chChartTypePieStacked

		end else

			Chart->Type = c->chChartTypePie

		end

	Case Type = 'BAR'

		If Stacked then

			Chart->Type = c->chChartTypeBarStacked

		end else

			Chart->Type = c->chChartTypeBarClustered

		end

		Chart->Type = c->chChartTypeBarClustered

	Case Type = 'AREA'

		If Stacked then

			Chart->Type = c->chChartTypeAreaStacked

		end else

			Chart->Type = c->chChartTypeArea

		end

	Case 1

		Chart->Type = c->chChartTypeColumClustered

End Case



Chart->HasLegend = True$

Chart->HasTitle = True$

Title = Chart->Title

Title->Caption = Header



* Add Series

SeriesCollection = Chart->SeriesCollection



Lcount = Count(Legend,@vm) + (Legend # '')



for i = 1 to Lcount

   Series = SeriesCollection->Add()  

   Series->Caption = Legend<1,i>  

   Categories=""

   Vals=""

   Xcount = Count(Xparms,@vm) + (Xparms # '')

   For j = 1 To Xcount

      Categories<j> = Xparms<1,j>

      Vals<j> = Iconv(Yparms<i,j>,'MD0')

   Next

   convert @fm to tab$ in categories

   convert @fm to tab$ in vals      

   x = Series->SetData(c->chDimCategories, c->chDataLiteral, Categories)

   x = Series->SetData( c->chDimValues, c->chDataLiteral, Vals)

next



* Export the chart to the temporary file

buffer = space(255)

ret = GetTempPath(len(buffer),buffer)

path = buffer[1,eos$]



ret = GetTempFilename(path, 'img', 0, buffer)

file = buffer[1,eos$]



x = ChartSpace->ExportPicture(file, "JPG", 640, 480)

osread image from file else image = ''

* Assume current window has a generic bitmap control



call Set_property(Control, 'IMAGE', image)

*osdelete file



return ''

At 16 JAN 2020 08:23AM Mike Ruane wrote:

I'm encouraged that the code has worked for 14 years.

We ( at Revelation ) take a lot of pains to try and be as backward compatible as possible.

Which is one reason we have clients that are still running basic code that was written in 1983 on a Pick box, and imported to Rev….

Anyway, have you looked at the O4W graphing capabilities?

Mike


At 16 JAN 2020 09:04AM Andrew McAuley wrote:

  • third_party_content/community/commentary/forums_works/c73676c1a805e74d9fa00b27a98f22fb.txt
  • Last modified: 2024/01/04 20:57
  • by 127.0.0.1