■ BubbleChartDataAdapter 클래스를 사용해 버블 차트 항목을 표시하는 방법을 보여준다.
▶ MainForm.cs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
using System.Data; using System.Globalization; using DevExpress.XtraEditors; using DevExpress.XtraMap; namespace TestProject { /// <summary> /// 메인 폼 /// </summary> public partial class MainForm : XtraForm { //////////////////////////////////////////////////////////////////////////////////////////////////// Field ////////////////////////////////////////////////////////////////////////////////////////// Private #region Field /// <summary> /// 빙 맵 키 /// </summary> private string bingKey = "INPUT YOUR BING KEY"; #endregion //////////////////////////////////////////////////////////////////////////////////////////////////// Constructor ////////////////////////////////////////////////////////////////////////////////////////// Public #region 생성자 - MainForm() /// <summary> /// 생성자 /// </summary> public MainForm() { InitializeComponent(); #region 빙 맵 데이터 공급자를 설정한다. this.bingMapDataProvider.BingKey = this.bingKey; #endregion #region 선형 범위 분포를 설정한다. LinearRangeDistribution linearRangeDistribution = new LinearRangeDistribution(); #endregion #region 측정 규칙을 설정한다. MeasureRules measureRules = new MeasureRules(); measureRules.ApproximateValues = true; measureRules.RangeDistribution = linearRangeDistribution; for(int i = 6; i < 10; i++) { measureRules.RangeStops.Add(i); } #endregion #region 데이터 테이블을 설정한다. DataSet dataSet = new DataSet(); dataSet.ReadXml("DATA\\Earthquakes.xml"); DataTable dataTable = dataSet.Tables[0]; dataTable.DefaultView.RowFilter = string.Format ( CultureInfo.InvariantCulture, "(mag >= {0}) AND (mag <= {1})", 6, 10 ); #endregion #region 버블 차트 데이터 어댑터를 설정한다. BubbleChartDataAdapter bubbleChartDataAdapter = new BubbleChartDataAdapter(); bubbleChartDataAdapter.MeasureRules = measureRules; bubbleChartDataAdapter.Mappings.Latitude = "glat"; bubbleChartDataAdapter.Mappings.Longitude = "glon"; bubbleChartDataAdapter.Mappings.Value = "mag"; bubbleChartDataAdapter.ItemMaxSize = 60; bubbleChartDataAdapter.ItemMinSize = 10; bubbleChartDataAdapter.DataSource = dataTable; bubbleChartDataAdapter.AttributeMappings.Add(new MapItemAttributeMapping("Magnitude", "mag")); bubbleChartDataAdapter.AttributeMappings.Add(new MapItemAttributeMapping("Year" , "yr" )); bubbleChartDataAdapter.AttributeMappings.Add(new MapItemAttributeMapping("Month" , "mon")); bubbleChartDataAdapter.AttributeMappings.Add(new MapItemAttributeMapping("Day" , "day")); bubbleChartDataAdapter.AttributeMappings.Add(new MapItemAttributeMapping("Depth" , "dep")); this.vectorItemsLayer.Data = bubbleChartDataAdapter; #endregion } #endregion } } |