MBS Xojo Developer Conference and Training
Join us from 11th to 14th September 2013 in Koblenz.
Join us from 11th to 14th September 2013 in Koblenz.
MBS Real Studio Plugin Tutorial Videos
ChartDirectorAnimation Source
Class App
Inherits Application
// Constants
Const kFileQuitShortcut = Ctrl+Q
Const kFileQuit = E&xit
Const kEditClear = &Delete
End Class
Class Window1
Inherits Window
// Controls
ControlInstance
Sub Paint(g As Graphics) Handles Event
g.DrawPicture pic,0,0
End Sub
End ControlInstance
ControlInstance
Sub ValueChanged(index as Integer) Handles Event
redraw
End Sub
End ControlInstance
ControlInstance
End ControlInstance
ControlInstance
Sub ValueChanged() Handles Event
redraw
End Sub
End ControlInstance
ControlInstance
Sub Action() Handles Event
if AnimationSlider.Value=AnimationSlider.Maximum then
me.Mode=0
else
AnimationSlider.Value=AnimationSlider.Value+5
end if
End Sub
End ControlInstance
ControlInstance
Sub Action() Handles Event
AnimationSlider.Value=0
AnimationTimer.Mode=2
End Sub
End ControlInstance
ControlInstance
Sub Action() Handles Event
dim f as FolderItem
f=GetSaveFolderItem(MyFileTypes.Quicktime,"test.mov")
if f=nil then Return
dim e as EditableMovie=f.CreateMovie
dim q as QTVideoTrack
q=E.NewVideoTrack(canvas1.Width, canvas1.Height, 25)
if not q.SelectCompressionSettings(pic) then
Return
end if
AnimationSlider.Value=0
dim c as integer = AnimationSlider.Maximum
for i as integer=0 to c step 2
AnimationSlider.Value=i
UpdateNow
q.AppendPicture pic
next
q=nil
call e.CommitChanges
e=nil
f.Launch
End Sub
End ControlInstance
// Properties
Dim pic As picture
// Event implementations
Sub Open()
render
End Sub
// Methods
Sub render()
dim data(-1) as Double
dim colors(-1) as integer
dim d,x as Double
dim i as integer
for i=0 to 6
d=Sliders(i).Value/10.0
data.Append d
next
dim maxvalue as Double
for i=0 to 6
if data(i)>maxvalue then
maxvalue=data(i)
end if
next
x=maxvalue*AnimationSlider.Value/1000.0
for i=0 to 6
if data(i)>x then
data(i)=x
end if
next
colors.Append CDXYChartMBS.rgb(213, 34, 70)
colors.Append CDXYChartMBS.rgb(73, 101, 198)
colors.Append CDXYChartMBS.rgb(71, 70, 129)
colors.Append CDXYChartMBS.rgb(69, 163, 69)
colors.Append CDXYChartMBS.rgb(250, 222, 74)
colors.Append CDXYChartMBS.rgb(101, 56, 154)
colors.Append CDXYChartMBS.rgb(105, 105, 105)
dim c as new CDXYChartMBS(canvas1.Width, canvas1.Height)
call c.addTitle("Votes on German election 2005", "timesbi.ttf", 18)
call c.setPlotArea(50, 55, canvas1.Width-80, canvas1.Height-80, c.linearGradientColor(0, 55, 0, 335, &hf9f9ff, &h6666ff), -1, &hFFFFFF, &hFFFFFF)
call c.xAxis.setLabels labels
c.xAxis.setTickOffset 0.5
call c.xAxis.setLabelStyle "arialbd.ttf", 10
call c.yAxis.setLabelStyle "arialbd.ttf", 10
c.xAxis.setWidth 2
c.yAxis.setWidth 2
c.yAxis.setLinearScale 0, maxvalue+5
call c.yAxis.setTitle "Percent", "arialbd.ttf", 10
dim layer as CDBarLayerMBS
layer=c.addBarLayer(data,colors)
layer.setBorderColor(c.kTransparent, c.glassEffect(c.kNormalGlare, c.kLeft))
layer.setBarGap 0.2, c.kTouchBar
if AnimationSlider.Value=1000 then
call layer.setDataLabelStyle "arialbd.ttf", 10
layer.setDataLabelFormat "{value}%"
end if
pic=C.makeChartPicture
End Sub
Sub redraw()
render
canvas1.Graphics.DrawPicture pic,0,0
End Sub
End Class
Links
MBS Real Studio Plugins