二维图表控件ecGraph2D的aardio调用示例
By
admin
at 2020-01-03 • 0人收藏 • 1949人看过
之前有分享过它的3d版控件, 查了下, 它还有个2d的控件 , 但是这个控件网上貌似没有和谐版
于是我根据看雪论坛里破解这个3d版控件的办法, 将这个2d的控件给和谐了,
废话不多说, 下面是aardio的调用示例:
import win.ui; /*DSG{{*/ var winform = win.form(text="aardio form";right=834;bottom=469) winform.add( button={cls="button";text="demo1";left=0;top=405;right=117;bottom=469;db=1;dl=1;z=2}; button2={cls="button";text="demo2";left=119;top=406;right=236;bottom=470;db=1;dl=1;z=3}; button3={cls="button";text="demo3";left=239;top=406;right=356;bottom=470;db=1;dl=1;z=4}; button4={cls="button";text="demo4";left=358;top=406;right=475;bottom=470;db=1;dl=1;z=5}; button5={cls="button";text="demo5";left=478;top=406;right=595;bottom=470;db=1;dl=1;dr=1;z=6}; button6={cls="button";text="demo6";left=598;top=406;right=715;bottom=470;db=1;dr=1;z=7}; button7={cls="button";text="demo7";left=718;top=405;right=835;bottom=469;db=1;dr=1;z=8}; static={cls="static";text="Static";left=0;top=0;right=835;bottom=395;db=1;dl=1;dr=1;dt=1;transparent=1;z=1} ) /*}}*/ var ecAliceBlue = 16775408 var ecAntiqueWhite = 14150650 var ecAqua = 16776960 var ecAquaMarine = 13959039 var ecAzure = 16777200 var ecBeige = 14480885 var ecBisque = 12903679 var ecBlack = 0 var ecBlanchedAlmond = 13495295 var ecBlue = 16711680 var ecBlueViolet = 14822282 var ecBrown = 2763429 var ecBurlywood = 8894686 var ecCadetBlue = 10526303 var ecChartreuse = 65407 var ecChocolate = 1993170 var ecCoral = 5275647 var ecCornflower = 15570276 var ecCornsilk = 14481663 var ecCrimson = 3937500 var ecCyan = 16776960 var ecDarkBlue = 9109504 var ecDarkCyan = 9145088 var ecDarkGoldenrod = 755384 var ecDarkGray = 11119017 var ecDarkGreen = 25600 var ecDarkKhaki = 7059389 var ecDarkMagenta = 9109643 var ecDarkOliveGreen = 3107669 var ecDarkOrange = 36095 var ecDarkOrchid = 13382297 var ecDarkRed = 139 var ecDarkSalmon = 8034025 var ecDarkSeaGreen = 9157775 var ecDarkSlateBlue = 9125192 var ecDarkSlateGrey = 5197615 var ecDarkTurquoise = 13749760 var ecDarkViolet = 13828244 var ecDeepPink = 9639167 var ecDeepSkyBlue = 16760576 var ecDimGray = 6908265 var ecDodgerBlue = 16748574 var ecFirebrick = 2237106 var ecFloralWhite = 15792895 var ecForestGreen = 2263842 var ecFuchia = 16711935 var ecGainsboro = 14474460 var ecGhostWhite = 16775416 var ecGold = 55295 var ecGoldenrod = 2139610 var ecGray = 8421504 var ecGreen = 32768 var ecGreenYellow = 3145645 var ecHoneyDew = 15794160 var ecHotPink = 11823615 var ecIndianRed = 6053069 var ecIndigo = 8519755 var ecIvory = 15794175 var ecKhaki = 9234160 var ecLavender = 16443110 var ecLavenderblush = 16118015 var ecLawnGreen = 64636 var ecLemonChiffon = 13499135 var ecLightBlue = 15128749 var ecLightCoral = 8421616 var ecLightCyan = 16777184 var ecLightGoldenrodYellow = 13826810 var ecLightGreen = 9498256 var ecLightGrey = 13882323 var ecLightPink = 12695295 var ecLightSalmon = 8036607 var ecLightSeaGreen = 11186720 var ecLightSkyBlue = 16436871 var ecLightSlateGray = 10061943 var ecLightSteelBlue = 14599344 var ecLightYellow = 14745599 var ecLime = 65280 var ecLimeGreen = 3329330 var ecLinen = 15134970 var ecMagenta = 16711935 var ecMaroon = 128 var ecMediumAquaMarine = 11193702 var ecMediumBlue = 13434880 var ecMediumOrchid = 13850042 var ecMediumPurple = 14381203 var ecMediumSeaGreen = 7451452 var ecMediumSlateBlue = 15624315 var ecMediumspringGreen = 10156544 var ecMediumTurquoise = 13422920 var ecMediumVioletRed = 8721863 var ecMidnightBlue = 7346457 var ecMintCream = 16449525 var ecMistyRose = 14804223 var ecMoccasin = 11920639 var ecNavajoWhite = 11394815 var ecNavy = 8388608 var ecOldlace = 15136253 var ecOlive = 32896 var ecOliveDrab = 2330219 var ecOrange = 42495 var ecOrangeRed = 17919 var ecOrchid = 14053594 var ecPaleGoldenrod = 11200750 var ecPaleGreen = 10025880 var ecPaleTurquoise = 15658671 var ecPaleVioletRed = 9662683 var ecPapayaWhip = 14020607 var ecPeachPuff = 12180223 var ecPeru = 4163021 var ecPink = 13353215 var ecPlum = 14524637 var ecPowderBlue = 15130800 var ecPurple = 8388736 var ecRed = 255 var ecRosyBrown = 9408444 var ecRoyalBlue = 14772545 var ecSaddleBrown = 1262987 var ecSalmon = 7504122 var ecSandyBrown = 6333684 var ecSeaGreen = 5737262 var ecSeaShell = 15660543 var ecSienna = 2970272 var ecSilver = 12632256 var ecSkyBlue = 15453831 var ecSlateBlue = 13458026 var ecSlateGray = 9470064 var ecSnow = 16448255 var ecSpringGreen = 8388352 var ecSteelBlue = 11829830 var ecTan = 9221330 var ecTeal = 8421376 var ecThistle = 14204888 var ecTomato = 4678655 var ecTurquoise = 13688896 var ecViolet = 15631086 var ecWheat = 11788021 var ecWhite = 16777215 var ecWhiteSmoke = 16119285 var ecYellow = 65535 var ecYellowGreen = 3329434 import com.lite; var dll = com.lite("\res\ecGraph2D.ocx"); var embed = dll.createEmbed(winform.static,"{DB45A02A-FBC5-46E8-963C-8769BE779955}"); var object = embed._object; object.RegisterecGraph("popdes") var demo1 = function(){ var i , X , Y ; with object{ Reset(); NewGraph("No-frills simple x-y graph") NewDataSet("Cubic spline") DataLine(ecBlue, 1, 3) for(i=1;9;1){ X = 2 * i Y = ..math.sqrt(i) - ..math.rad(i) / 3 AddDataPoint(X, Y) } Refresh(); } } var demo2 = function(){ var i , X, Y; var Font = "Font=Arial|9|bold|italic" with object{ Reset() NewGraph("2D Bar Graph") GraphTitleStyle(, "Font=Times New Roman|18|bold", 255788, -8, -12) BorderStyle(ecCadetBlue, ecLightCyan, 90) AxisStyle(ecBlack, 2); //set x-axis line thickness to 2 AxisTitleStyle("Item category", Font, ecDarkBlue) AxisLabelStyle(Font, ecDarkBlue) SelectYaxis()// select the y-axis. AxisStyle(ecDarkBlue, 2) //set x-axis line thickness to 2 AxisTitleStyle("Sales frequency", Font, ecDarkBlue, -3) AxisLabelStyle(Font, ecDarkBlue, -1) LegendTableStyle(Font, ecBlack, 12, 16, , 0, , , , , , true) //Start a new data set on the graph, and add random points.. NewDataSet(" Data 1") SymbolStyle(1, 5, ecGold, ecDarkBlue, 2, false, 1.5, true) //2D bar, width 5mm for(i=1;9;1){ X = 2 * i Y = ..math.sqrt(i) + 1 + ..math.random() / 3 AddDataPoint(X, Y) } //Start a new data set on the graph, and add random points.. NewDataSet(" Data 2") SymbolStyle(1, 5, , , , , -1.5, true) //2D bar, width 5mm for(i=1;9;1){ X = 2 * i Y = ..math.sqrt(i) - ..math.random() / 3 AddDataPoint(X, Y) } PlotAreaColors(ecBlue, ecLightBlue, 90) Refresh()//Always end with "Refresh" } } var demo3 = function(){ var i, X , Y with object{ Reset()//Always call "Reset" first to clear the page //Start a new graph on the page.. NewGraph("Bar Graph, 3D bars, colors and styles") BorderStyle(ecCadetBlue, ecLightCyan, 0, 1, , , -1, 7, -1, -1) LegendTableStyle(, , 21, 25, , 0, , , , , , true) //Start a new data set on the graph, and add random points.. NewDataSet("Data 1") SymbolStyle(1, 7, ecLightCyan, 6750208, 1, true) //3D bar, width 5mm for(i=1;9;1){ X = 2 * i Y = ..math.sqrt(i) - ..math.random() / 2 AddDataPoint(X, Y) } PlotAreaColors(ecBlack, ecBlue, 120, , -6) Refresh() //Always end with "Refresh" } } var demo4 = function(){ var i, X , Y with object{ Reset()// 'Always call "Reset" first to clear the page //Start a new graph on the page.. NewGraph("Multiple 3D Bar Graph, Text labels") GraphTitleStyle(, "bold|16|italic", ecBlue, 15, -10) BorderStyle(ecCadetBlue, ecLightCyan, 0, , , , 20, 7, -1, -1) PlotAreaColors(ecBurlywood, ecLightCyan, 90) LegendTableStyle(, , 15, 10, , 0, , , , , , true) AxisStyle(, 3) AxisLabelStyle("bold||11|", , -3, 0) AxisTitleStyle(, "bold|11|", , 0, false) AxisTickStyle(, , false, false, false) AxisScaleStyle(0, 30, 6, 0, 2, ",Wombats,Koalas,Possums,Wallabies,Kangaroos") SelectYaxis() AxisStyle(, 3) AxisLabelStyle("bold||11|", , -1, 0) AxisTitleStyle(, "bold|11|", , -4, false) AxisScaleStyle(0, 5, 5, 0, 2, ",low,medium,high,very high") AxisTickStyle(, , false, false, false) AxisGridStyle(ecGray, , true, false) //Start a new data set on the graph, and add random points.. NewDataSet("Cuddly") SymbolStyle(1, 5, ecLightBlue, 6750208, 1, true, -4.9, true) //3D bar, width 5mm for(i=1;5;1){ X = 5 * i Y = 2 + 2 * ..math.random() AddDataPoint(X, Y) } //Start a new data set on the graph, and add random points.. NewDataSet("Friendly") SymbolStyle(1, 5, ecLightPink, ecMaroon, 1, true, 0, true) //2D bar, width 5mm for(i=1;5;1){ X = 5 * i Y = 2 + 2 * ..math.random() AddDataPoint(X, Y) } //Start a new data set on the graph, and add random points.. NewDataSet("Cute") SymbolStyle(1, 5, ecLightGreen, ecDarkGreen, 1, True, 4.9, True) //2D bar, width 5mm for(i=1;5;1){ X = 5 * i Y = 2 + 2 * ..math.random() AddDataPoint(X, Y) } Refresh() //Always end with "Refresh" } } var demo5 = function(){ var i , Color, X , Y var Symbol, SymbolSize, Line, Legend with object{ Reset()// 'Always call "Reset" first //Start the first graph... NewGraph("Two data sets, grid lines, black background") GraphTitleStyle(, , , , , false) BorderStyle(ecDarkSeaGreen) PlotAreaColors(ecBlack) AxisGridStyle(ecGray, ecDarkGreen) LegendTableStyle(, , 11, 8, , , ecLightGrey, ecLightGrey) AxisLabelStyle("bold") AxisTitleStyle("x-axis", "bold") SelectYaxis()// select the y-axis before adjusting its style AxisLabelStyle("bold", , -1) AxisTitleStyle("y-axis", "bold", , -3) //First data set for this graph NewDataSet("Data set 1") DataLine(ecBlue, 2) SymbolStyle(3, 3.5, ecBlue, ecYellow, 2) for(i=1;14;1){ X = 1.4 * i Y = ..math.sqrt(i) + ..math.random() AddDataPoint(X, Y) } //Second data set for this graph NewDataSet("Data set 2") SymbolStyle(3, 3.5, ecRed, ecYellow, 2) for(i=1;14;1){ X = 1.4 * i Y = ..math.sqrt(i) - ..math.random() AddDataPoint(X, Y) } Refresh()// Always end with "Refresh" } } var demo6 = function(){ //Two graphs on the Page var MathFunc, S, i, Color, X, Y var Symbol, SymbolSize, Line, Legend with object{ Reset()// 'Always call "Reset" first PageColors(ecCoral, ecBlanchedAlmond) //Start the first graph... NewGraph("Graph 1") GraphPosition(2, 2, 80, 50) BorderStyle(ecHotPink, ecBlanchedAlmond, , , , , 12, 6, 6, 10) PlotAreaColors(ecLightPink, ecBlanchedAlmond) //First data set for this graph NewDataSet("Data 1") for(i=1;19;1){ X = i Y = ..math.sqrt(i) + ..math.random() AddDataPoint(X, Y) } //Second data set for this graph NewDataSet("Data 1") for(i=1;19;1){ X = i Y = ..math.sqrt(i) - ..math.random() AddDataPoint(X, Y) } //Add text.. NewDataSet("Text") S = "Click to bring graph to front" + '\r\n' + "Drag graphs to reposition" + '\r\n' + "Drag legend table" AddText(S, 5, 95, 0, "bold", ecRed, 0, true) //Second graph... NewGraph("Graph 2") GraphPosition(30, 40, 65, 55) BorderStyle(ecAquaMarine, ecBlanchedAlmond, , , , , 12, 5, 6, 10) LegendTableStyle(, , 15, 10, ecGray, 0, , , , , , true) PlotAreaColors(ecLightBlue, ecBlanchedAlmond) NewDataSet("Data 1") SymbolStyle(2) for(i=1;300;1){ X = i / 16 Y = ..math.sqrt(X) + ..math.random() AddDataPoint(X, Y) } //Add a math function.. MathFunc = "0.5 + sqr(x)" NewDataSet("y = " + MathFunc) AddMathFunc(MathFunc, 0, 20) //Add a math function.. MathFunc = "2 + sin(x)" NewDataSet("y = " + MathFunc) AddMathFunc(MathFunc, 0, 20) //Add text.. NewDataSet("Text") S = "Click & drag to zoom in" + '\r\n' + "Use scroll bars when zooming" + '\r\n' + "Right click to unzoom" AddText(S, 45, 48, 0, "bold", vbRed, 0, True) Refresh()// 'Always end with "Refresh" } } var demo7 = function(){ //Multiple x- and y-axes var i , X , Y with object{ Reset()// 'Always call "Reset" first NewGraph("Multiple x- and y-axes") //Start a new graph on the page AxisTitleStyle("First x-axis", , , 0) BorderStyle(ecPurple, ecAliceBlue, 90) PlotAreaColors(ecBrown, ecAliceBlue, 0) BorderStyle(, , , , , , 33, 6, 6, 32) LegendTableStyle(, , 25, 10, , , 14408703, 14408703) SelectYaxis() AxisTitleStyle("First y-axis", , , 0) NewDataSet("First axis Data") //Start a new data set on the graph for(i=1;18;1){//Add some data points to the graph X = 100 + i Y = 100 + ..math.sqrt(i) + 2 * ..math.random() AddDataPoint(X, Y) } NewXAxis("Second x-Axis") NewYAxis("Second y-Axis") NewDataSet("Second axis Data")//Start a new data set on the graph for(i=1;18;1){ //Add some data points to the graph X = 50 + i Y = 80 + ..math.sqrt(i) + 2 * ..math.random() AddDataPoint(X, Y) } NewXAxis("Third x-Axis") NewYAxis("Third y-Axis") NewDataSet("Third axis Data") //Start a new data set on the graph for(i=1;18;1){ //Add some data points to the graph X = 10 + i Y = 60 + ..math.sqrt(i) + 2 * ..math.random() AddDataPoint(X, Y) } Refresh()// 'Always end with "Refresh" } } demo1() winform.button.oncommand = function(id,event){ demo1() } winform.button2.oncommand = function(id,event){ demo2() } winform.button3.oncommand = function(id,event){ demo3() } winform.button4.oncommand = function(id,event){ demo4() } winform.button5.oncommand = function(id,event){ demo5() } winform.button6.oncommand = function(id,event){ demo6() } winform.button7.oncommand = function(id,event){ demo7() } winform.show(); win.loopMessage(); return winform;
破解版ecGraph2D下载:
函数手册:
3 个回复 | 最后更新于 2020-01-06
禁止图表缩放
object.setGraphAllowZoom(false)
禁止显示鼠标位置信息
object.setGraphShowXY(false)
禁止显示图例
object.setLegendShow(false)
改变背景色和线条颜色
//背景色 object.BorderStyle(ecDarkSeaGreen) //波形区域背景色 object.PlotAreaColors(ecBlack) //XY轴线颜色 object.AxisGridStyle(ecGray, ecDarkGreen) //设置波形线条颜色 object.SymbolStyle(3, 3.5, ecBlue, ecYellow, 2)
登录后方可回帖
如果要禁止生成的图表被鼠标移动
如上, 必须放到refresh之前