i need draw graphs project working on , @ moment trying use oxyplot library draw graph on windows form. code have written @ moment is:
dim graph oxyplot.plotmodel = new oxyplot.plotmodel graph.title = "test" dim s1 oxyplot.series.lineseries s1.points.add(new oxyplot.datapoint(2, 7)) s1.points.add(new oxyplot.datapoint(7, 9)) s1.points.add(new oxyplot.datapoint(9, 4)) graph.series.add(s1) end sub
i not sure how proceed here plot graph on form. there oxyplot documentation on plotting in forms vb.net ones can seem find c#
i have struggled finding way implement oxyplot on windows form in vb.net.
the simplest way remains adding plot windows form through toolbox. that, have add oxyplot control toolbox first (e.g. tools > choose toolbox items...) , on .net component tab browse , find oxyplot.windowsforms.dll in project bin folder. step used fail long time me no control found in dll, achieved after uninstalling oxyplot packages , putting them back. once done, should able add new "plotview1" plotview instance on form toolbox drag , drop. place it, resize it, set way want.
then on form1.designer.vb, have added few lines on initializecomponent() sub between "plotview1" , "form1" blocks add series , have showing up:
private sub initializecomponent() me.plotview1 = new oxyplot.windowsforms.plotview() me.suspendlayout() ' 'plotview1 ' me.plotview1.location = new system.drawing.point(12, 12) me.plotview1.name = "plotview1" me.plotview1.pancursor = system.windows.forms.cursors.hand me.plotview1.size = new system.drawing.size(260, 238) me.plotview1.tabindex = 0 me.plotview1.text = "plotview1" me.plotview1.zoomhorizontalcursor = system.windows.forms.cursors.sizewe me.plotview1.zoomrectanglecursor = system.windows.forms.cursors.sizenwse me.plotview1.zoomverticalcursor = system.windows.forms.cursors.sizens ' 'sample series ' plotmod.title = "test" s1.points.add(new oxyplot.datapoint(2, 7)) s1.points.add(new oxyplot.datapoint(7, 9)) s1.points.add(new oxyplot.datapoint(9, 4)) plotmod.series.add(s1) me.plotview1.model = plotmod ' 'form1 ' me.autoscaledimensions = new system.drawing.sizef(6.0!, 13.0!) me.autoscalemode = system.windows.forms.autoscalemode.font me.clientsize = new system.drawing.size(284, 262) me.controls.add(me.plotview1) me.name = "form1" me.text = "window" me.resumelayout(false) end sub
as not regular programmer, expect there more appropriate ways of coding sample.
Comments
Post a Comment