主要介紹 Visifire 常用屬性的設置,用來生成不同樣式的圖例
設置Chart的屬
//設置title的值 // 創建一個標題的對象 Title title = new Title(); // 設置標題的名稱 title.Text = titleText; title.Padding = new Thickness(0, 10, 5, 0); // 向圖標添加標題 chart.Titles.Add(title); //是否顯示3D效果 chart.View3D = view3D; //圖表數據過多滾動顯示 chart.ScrollingEnabled = isScroll; chart.Watermark = false;//去掉水印 //設置繪制圖表的形狀 (枚舉) ds.RenderAs = RenderAs.Column;
// 設置繪制線條的樣式
ds.Linetyle = LineStyles.Dotted;
//圖標描述 ds.LegendText = legendText; ds.ShowInLegend = showLegend; //是否顯示坐標點數據 ds.LabelEnabled = showLabel;
設置坐標軸的屬性
#region 設置x抽信息 AxisLabels xLabel = new AxisLabels(); xLabel.FontColor = new SolidColorBrush(Colors.Gray); //x軸刻度文本信息顏色 ChartGrid xGrid = new ChartGrid();//設置x軸的縱向刻度虛線 xGrid.Enabled = false; Axis xAxis = new Axis(); xAxis.Enabled = true; //是否顯示X軸刻度、文本 xAxis.AxisLabels = xLabel; xAxis.Grids.Add(xGrid); chart.AxesX.Add(xAxis); #endregion #region 設置y抽信息 AxisLabels yLabel = new AxisLabels(); yLabel.FontColor = new SolidColorBrush(Colors.LightGray); //y軸刻度文本信息顏色 ChartGrid yGrid = new ChartGrid();// 設置y軸的橫向刻度虛線 yGrid.Enabled = true; Axis yAxis = new Axis(); yAxis.Enabled = yAxisEnabeld; //是否顯示Y軸刻度、文本 yAxis.Grids.Add(yGrid); yAxis.AxisMinimum = minValue; //y軸刻度最小值 yAxis.AxisMaximum = maxValue; //y軸刻度最大值 yAxis.Prefix = pre; //"給刻度添加前綴"; yAxis.Suffix = suf; //"給刻度添加后綴 如%"; yAxis.Interval = 10; //設置y軸刻度的增量 -- 即2個刻度值之間的的間隔 yAxis.IntervalType = IntervalTypes.Number; yAxis.AxisLabels = yLabel; chart.AxesY.Add(yAxis); #endregion
設置坐標軸各數據的屬性
//設置坐標點的大小(線條圖) dp.MarkerScale = 10; dp.MarkerSize = 5; //坐標點的顏色 dp.Color = new SolidColorBrush(Colors.Red); //坐標點數值的顏色 dp.LabelFontColor = new SolidColorBrush(Colors.Blue);
參考:http://www.cnblogs.com/forgetu/archive/2010/06/26/visifire-axis.html