alias setfont {
!.echo -q $com($1,font,2,dispatch* font)
.comclose font $com(font,$2,4,uint,$$3)
}
alias setgridlines {
return $com($1,hasmajorgridlines,4,bool,$2)
}
alias fillcolor {
!.echo -q $com($1,fill,2,dispatch* fill)
.comclose fill $com(fill,forecolor,2,dispatch* forecolor)
.comclose forecolor $com(forecolor,schemecolor,4,uint,$2)
}
alias chart {
var %t
.comopen excel.main excel.application
%t = $com(excel.main,visible,4,bool,true)
%t = $com(excel.main,workbooks,2,dispatch* excel.books)
%t = $com(excel.books,open,1,bstr*,$mircdirgraph.csv,dispatch* excel.book)
%t = $com(excel.main,worksheets,2,uint,1,dispatch* excel.sheet)
%t = $com(excel.sheet,range,3,bstr,a1:y6,dispatch* excel.range)
%t = $com(excel.sheet,chartobjects,2,dispatch* chobjs)
%t = $com(chobjs,add,1,uint,100,uint,60,uint,400,uint,200,dispatch* chart)
%t = $com(chart,chart,2,dispatch* excel.chart)
%t = $com(excel.chart,chartwizard,1,dispatch,excel.range,uint,4,uint,2,uint,1,uint,1,uint,1,bool,true,bstr,$+(Dalnet,$lf,$fulldate))
; retrieving objects to x and y axis
%t = $com(excel.chart,axes,1,uint,1,dispatch* x-axis)
%t = $com(excel.chart,axes,1,uint,2,dispatch* y-axis)
; retrieving label objects
%t = $com(x-axis,ticklabels,2,dispatch* x-labels)
%t = $com(y-axis,ticklabels,2,dispatch* y-labels)
; set x-axis label orientation to -90 degrees
%t = $com(x-labels,orientation,4,int,-90)
; set labelticks for each hour
%t = $com(x-axis,TickLabelSpacing,4,uint,1)
setfont x-labels size 8
setfont y-labels size 8
setgridlines x-axis true
setgridlines y-axis true
; retrieve majorgridlinesobj and make color red
%t = $com(x-axis,majorgridlines,2,dispatch* majorgridlines)
%t = $com(majorgridlines,border,2,dispatch* border)
comclose border $com(border,color,4,long,$rgb(255,0,0))
%t = $com(excel.chart,chartarea,2,dispatch* area)
fillcolor area 12
%t = $com(excel.chart,charttitle,2,dispatch* title)
setfont title size 8
setfont title color $rgb(255,0,0)
; plotarea: border
%t = $com(excel.chart,plotarea,2,dispatch* plotarea)
%t = $com(plotarea,border,2,dispatch* border)
comclose border $com(border,color,4,long,$rgb(255,0,0))
; plotarea color
%t = $com(plotarea,fill,2,dispatch* fill)
fillcolor plotarea 5
; plotarea outer and top coordinates
%t = $com(plotarea,height,4,uint,99999)
%t = $com(plotarea,top,4,uint,32)
; legend: font and fill color
%t = $com(excel.chart,legend,2,dispatch* legend)
setfont legend size 8
fillcolor legend 6
%t = $com(excel.chart,export,1,bstr*,$mircdirchart.jpg)
:error
tokenize 32 books sheet range charts chart
if ($com(excel.book)) .comclose excel.book $com(excel.book,close,1,bool,false)
if ($com(excel.main)) .comclose excel.main $com(excel.main,quit,1)
comcloseall
}
alias comcloseall while ($com(1)) .comclose $v1