DEV控制項ChartControl用法

2021-07-08 14:45:14 字數 4087 閱讀 9734

#region 僅供參考

控制x、y軸顯示

xydiagram diagram = (xydiagram)chartcontrol.diagram;

diagram.axisx.label.staggered = true;

diagram.axisy.label.begintext = "axis value = ";

diagram.axisy.label.angle = -30;

diagram.axisy.label.antialiasing = true;

xydiagram diagram = (xydiagram)chartcontrol.diagram;

diagram.axisx.datetimemeasureunit = datetimemeasurementunit.second;

diagram.axisx.datetimeoptions.format = datetimeformat.custom; diagram.axisx.datetimeoptions.formatstring = "hh:mm:ss";

((xydiagram)mychartcontrol.diagram).axisx.interlaced = true;

((xydiagram)mychartcontrol.diagram).axisx.gridspacing = 10;

((xydiagram)mychartcontrol.diagram).axisx.label.angle = -30;

((xydiagram)mychartcontrol.diagram).axisx.label.antialiasing = true;

((xydiagram)mychartcontrol.diagram).axisx.datetimeoptions.format = datetimeformat.monthandday;

xydiagram xydiagram1 = new xydiagram();

xydiagram1.axisx.range.auto = false; //要開啟滾動條必須將其設定為false

= 30.5d > (cnt + 1) ? (cnt + 1) : 30.5d;//在不拉到滾動條的時候,x軸顯示多個值,既固定的x軸長度。

= -0.5d;

xydiagram1.axisx.range.scrollingrange.auto = false;

xydiagram1.axisx.minorcount = 9; //顯示x軸間隔數量

xydiagram1.axisx.tickmarks.minorvisible = true;//是否顯示x軸間隔

xydiagram1.axisy.minorcount = 1;//顯示y軸間隔數量

xydiagram1.axisy.tickmarks.minorvisible = true;//是否顯示y軸間隔

xydiagram1.axisx.range.scrollingrange.maxvalueserializable = (cnt + 1).tostring();//整個x軸最多顯示多多少個值

xydiagram1.axisx.range.scrollingrange.minvalueserializable = "0";

xydiagram1.axisx.datetimemeasureunit = datetimemeasurementunit.second;

xydiagram1.axisx.datetimeoptions.format = datetimeformat.custom;

xydiagram1.axisx.datetimeoptions.formatstring = "yyyy:mm:hh";

xydiagram1.axisx.range.scrollingrange.sidemarginsenabled = true;//是否從x軸原點開始顯示

xydiagram1.axisx.range.sidemarginsenabled = false;

xydiagram1.axisx.visibleinpanesserializable = "-1";

xydiagram1.axisy.numericoptions.format = devexpress.xtracharts.numericformat.percent;//顯示為百分數

xydiagram1.axisy.range.auto = false;

xydiagram1.axisy.range.maxvalueserializable = "1.02";

xydiagram1.axisy.range.minvalueserializable = "0.5";

xydiagram1.axisy.range.scrollingrange.sidemarginsenabled = true;

xydiagram1.axisy.range.sidemarginsenabled = true;

xydiagram1.axisy.visibleinpanesserializable = "-1";

xydiagram1.enablescrolling = true;//啟用滾動條

獲取diagram必須在chartcontrol中已經加入了series之後

((xydiagram)chartcontrol.diagram).rotated = false;

#endregion

圖示位置

mychartcontrol.legend.alignmenthorizontal = legendalignmenthorizontal.right;

mychartcontrol.legend.alignmentvertical = legendalignmentvertical.top;

charttitle charttitle = new charttitle();

charttitle.text = this.text;//標題內容

charttitle.textcolor = system.drawing.color.black;//字型顏色

charttitle.font = new font("tahoma", 8);//字型型別字型大小

charttitle.dock = charttitledockstyle.bottom;//標題對齊方式

charttitle.alignment = stringalignment.far;

mychartcontrol.titles.clear();//清理標題

mychartcontrol.titles.add(charttitle);//載入標題

series series1 = new series(this.text, viewtype.spline);

series1.argumentscaletype = scaletype.datetime;//x軸型別

series1.valuescaletype = scaletype.numerical;//y軸型別

//x軸的資料字段

series1.argumentdatamember = "statisticstime";

//y軸的資料字段

series1.valuedatamembers[0] = "statisticssum";

//定義線條上點的標識形狀是否需要

((lineseriesview)series1.view).linemarkeroptions.visible = false;

//定義線條上點的標識形狀

((lineseriesview)series1.view).linemarkeroptions.kind = markerkind.circle;

//不顯示x、y軸上面的交點的值

((pointserieslabel)series1.label).visible = false;

//線條的型別,虛線,實線

((lineseriesview)series1.view).linestyle.dashstyle = dashstyle.solid

以上只是為方便檢視,最好用的還是官方文件 

winforms controls > controls and libraries > chart control

dev控制項 chartControl控制項

1.chartcontrol1設定圖例上的數量 series1.showinlegend false 設定是否顯示說明 series1.label.visible true 設定是否顯示引線文字 第乙個屬性根據其 設定有時可要可不要 第二個必須要 2.chartcontrol1 資料過多時加滾輪 x...

DEV 控制項使用技巧

dev 控制項之gridcontrol checkedit 控制項 獲取行 多選框中的值 需要先關閉修改 既gridview.closeeditor var value gridview.getdatarow i fieldname tostring 獲取單元格的值方法 datatabe dt da...

Dev控制項使用學習

1.barmanager管理 1.1 barcheckitem的checkchanged事件發生在選擇狀態改變之後。1.2 baredititem comboboxedit 新增item 1 string item comboboxitem1 devexpress.xtraeditors.repos...