[DevExpress] Explode settings, devexpressexplode
Key code:
/// <Summary> /// pie chart highlight settings /// </summary> /// <param name = "chart"> ChartControl </param> /// <param name = "pieSeries"> Series [applies only to PieSeriesView] </param> // <param name = "explodeMode"> highlight mode [enumeration] </param> /// <param name = "explodedValue"> margin </param> // <param name = "dragPie"> whether to drag to highlight a pie chart </param> public static void SetPieExplode (this chartControl chart, series pieSeries, PieExplodeMode explodeMode, int explode DValue, bool dragPie) {if (pieSeries. View is PieSeriesView) {// bool _ hitTesting = chart. RuntimeHitTesting; if (! Chart. runtimeHitTesting) chart. runtimeHitTesting = true; PieSeriesView _ pieView = pieSeries. view as PieSeriesView; _ pieView. explodeMode = explodeMode; _ pieView. explodedDistancePercentage = explodedValue; _ pieView. runtimeExploding = dragPie; // chart. runtimeHitTesting = _ hitTesting ;}}
Code usage:
private void BuilderDevChart() { Series _pieSeries = new Series("Series 1", ViewType.Pie); _pieSeries.ValueDataMembers[0] = "Value"; _pieSeries.ArgumentDataMember = "Name"; _pieSeries.DataSource = CreateChartData(); chartControl1.Series.Add(_pieSeries); //---------------------------------------- _pieSeries.LegendPointOptions.PointView = PointView.ArgumentAndValues; _pieSeries.SetPiePercentage(NumericFormat.Percent, PointView.ArgumentAndValues); chartControl1.SetAxisXTitle("test", Color.Red); _pieSeries.SetLablePosition(PieSeriesLabelPosition.TwoColumns); chartControl1.SetPieExplode(_pieSeries, PieExplodeMode.MinValue, 5, true); }
Running effect:
How to draw a pie chart in Matlab
You can use the pix function in Matlab to create a pie chart. The Calling format of the pie function is as follows:
Pie (X)
Use the data in X to draw a pie chart. Each element in X is represented by a slice area in the pie chart.
Pix (X, eplode)
Separate a slice area from the pie chart. The explode is a zero or non-zero matrix corresponding to X. The Slice corresponding to the non-zero value is separated from the pie chart. Therefore, if explode (I, j) is not zero, the slice corresponding to X (I, j) is separated from the center. Exploade must have the same size as X.
H = pie (...)
Returns the handle vector to the shadow and Text Graphics objects.
How to draw a pie chart in matlab
A = [30 30 10];
T = {'State units '; 'private-owned enterprises'; 'research and study'; 'unemployed '};
Explode = [1 0 1 0];
Pie (a, explode );
Colormap jet;
Title ('graduate whereabouts ', 4 );
Legend (t, 4 );