2024年3月21日发(作者:)

c# ms chart 控件使用方法

第一个简单的chart: spline// Create new data series and set it's visualattributes

Series series = new Series("Spline");

ype = ;

Width = 3;

Offset = 2;

// Populate new series with data

(67);

(57);

(83);

(23);

(70);

(60);

(90);

(20);

// Add series into the chart's series collection

(series);

同时显示2条曲线

// Populate series with random data

Random random = new Random();

for (int pointIndex = 0; pointIndex < 10;pointIndex++)

{

["Series1"].((45, 95));

["Series2"].((5, 75));

}

// Set series chart type

["Series1"].ChartType = ;

["Series2"].ChartType = ;

// Set point labels

["Series1"].IsValueShownAsLabel = true;

["Series2"].IsValueShownAsLabel = true;

// Enable X axis margin

reas["ChartArea1"].inVisible = true;

// Enable 3D, and show data point marker lines

reas["ChartArea1"].3D = true;

["Series1"]["ShowMarkerLines"] = "True";

["Series2"]["ShowMarkerLines"] = "True";

显示column类型图

// Create new data series and set it's visual attributes

Series series = new Series("FlowRead");

ype = ;

Width = 3;

Offset = 2;

// Populate new series with data

(67);

(57);

(83);

(23);

(70);

(60);

(90);

(20);

// Add series into the chart's series collection

(series);

很多点,效率还可以

// Fill series data

double yValue = 50.0;

Random random = new Random();

for (int pointIndex = 0; pointIndex < 20000;pointIndex++)

{

yValue = yValue + (uble() * 10.0 - 5.0);

["Series1"].(yValue);

}

// Set fast line chart type

["Series1"].ChartType = ne;

}