visifire 图表双坐标轴 silverlight
public void CreateChart(Grid oGrid, ObservableCollection<ListItem> lBaseOilBar)
{
foreach (ListItem li in lBaseOilBar)
{
//图表大小,框线
Chart chart = new MyCharts();
chart.Width = 800;
chart.Height = 600;
chart.ScrollingEnabled = false;
//图表标题
Title title = new Title();
string sTitle = li.Title;
title.Text = sTitle;
title.FontSize = 16;
chart.Titles.Add(title);
// X 坐标轴
Axis axisX = new Axis();
AxisLabels xal = new AxisLabels
{
FontSize = 14//设置文字大小
};
axisX.AxisLabels = xal;
chart.AxesX.Add(axisX);
// Y 坐标轴
Axis axisY = new Axis();
AxisLabels yal = new AxisLabels
{
FontSize = 14//设置文字大小
};
axisY.AxisLabels = yal;
//Y轴数据单位
string sYUint = li.YUint;
axisY.Title = sYUint;
axisY.TitleFontSize = 15;
chart.AxesY.Add(axisY);
if (li.ChartType == "Column") //柱状图
{
switch (li.YAXISs.Count())
{
case 1:
chart.DataPointWidth = 4;//设置柱子宽度
break;
case 2:
chart.DataPointWidth = 2.5;
break;
case 3:
chart.DataPointWidth = 1.8;
break;
}
}
title.MouseLeftButtonDown += new MouseButtonEventHandler(title_MouseLeftButtonDown);
////设置图标字体大小
//Legend legend = new Legend();
//legend.FontSize = 13;
//chart.Legends.Add(legend);1
//X轴数据
string[] sXLabel = li.XAXIS.ToArray();
string sTableName = "";
#region 点击是否触发事件,钻取数据图表赋值一个物理表名
bool ifGetSig = false;
switch (li.ChartName)
{
case "Stock":
sTableName = "StockSingleOildom";
ifGetSig = true;
break;
case "Drill_JC":
sTableName = "Drill_JCSingleOildom";
ifGetSig = true;
break;
case "EXTRACTIONOIL":
sTableName = "EXTRACTIONOILSingleOildom";
ifGetSig = true;
break;
case "Drill_MACHINE":
sTableName = "Drill_MACHINESingleOildom";
ifGetSig = true;
break;
case "PROVEDRILL":
sTableName = "PROVEDRILLSingleOildom";
ifGetSig = true;
break;
}
#endregion
#region 图表柱状个数,循环加载数据
ColorSet cs = new ColorSet();
cs.Id = "colorset1"; // 设置ColorSet 的 Id 为 colorset1
//foreach (YAXIS oYAXIS in li.YAXISs)
for (int j = 0; j < li.YAXISs.Count(); j++)
{
YAXIS oYAXIS = (YAXIS)li.YAXISs[j];
string sYTitle = "";
sYTitle = oYAXIS.Name;
double[] dYValue = null;
dYValue = oYAXIS.YValue.ToArray();
DataSeries dataSeries = new DataSeries();
dataSeries.LegendText = sYTitle;
#region 双坐标轴
string IsTwoY = "";
IsTwoY = oYAXIS.TWOY;
if (IsTwoY == "true")
{
Axis axisYT = new Axis() { AxisType = AxisTypes.Secondary };
AxisLabels yalT = new AxisLabels
{
//Enabled = true, //设置是否显示坐标轴上的文本,默认值为true
//Angle = 45,//设置文本显示的角度,取值为 –90 至 90
FontSize = 14//设置文字大小
};
axisYT.AxisLabels = yalT;
axisYT.AxisMinimum = 0;
axisYT.AxisMaximum = 100;
//Y轴数据单位
string sYUintT = li.YUintT;
axisYT.Title = sYUintT;
axisYT.TitleFontSize = 15;
chart.AxesY.Add(axisYT);
dataSeries.AxisYType = AxisTypes.Secondary;
}
#endregion
else
{
dataSeries.AxisYType = AxisTypes.Primary;
}
#region 设置柱状图的颜色 待开发
//ColorSet cs = new ColorSet();
//string strColor = oYAXIS.Color;
//////Colors oColors = new Colors();
//cs.Id = "colorset1"; // 设置ColorSet 的 Id 为 colorset1
//cs.Brushes.Add(new SolidColorBrush(Colors.Green));
//cs.Brushes.Add(new SolidColorBrush(Colors.Red));
//cs.Brushes.Add(new SolidColorBrush(Colors.Blue));
////cs.Brushes.Add(new SolidColorBrush(Colors.Yellow));
////cs.Brushes.Add(new SolidColorBrush(Colors.Orange));
//chart.ColorSets.Add(cs);
//chart.ColorSet = "colorset1"; // 设置 Chart 使用自定义的颜色集合 colorset1
string strColor = oYAXIS.Color;
switch (strColor)
{
case "Red":
cs.Brushes.Add(new SolidColorBrush(Color.FromArgb(0xff, 0xff, 0x45, 0x00))); //#FFFF4500 orangeRed
break;
case "Yellow":
cs.Brushes.Add(new SolidColorBrush(Color.FromArgb(0xff, 0xda, 0xa5, 0x20)));//FFDAA520 Goldenrod
break;
case "Orange":
cs.Brushes.Add(new SolidColorBrush(Colors.Orange));
break;
case "Green":
cs.Brushes.Add(new SolidColorBrush(Colors.Green));
break;
case "Blue":
cs.Brushes.Add(new SolidColorBrush(Color.FromArgb(0xff, 0x41, 0x69, 0xe1))); //FF4169E1 RoyalBlue
break;
default:
break;
}
#endregion
#region 图表类型(柱状,饼状……)
string sChartType = li.ChartType;
RenderAs oRenderAs = new RenderAs();
switch (sChartType)
{
case "Column":
oRenderAs = RenderAs.Column;
break;
case "Pie":
oRenderAs = RenderAs.Pie;
//dataSeries.LabelFontSize = 14;//设置图标字体大小
break;
case "Line":
oRenderAs = RenderAs.Line;
break;
}
dataSeries.RenderAs = oRenderAs;
#endregion
#region 构造数据
DataPoint dp;
if (sXLabel != null)
{
for (int i = 0; i < sXLabel.Length; i++)
{
dp = new DataPoint();
dp.AxisXLabel = sXLabel[i];
dp.YValue = dYValue[i];
if (ifGetSig)
{
dp.Tag = sTableName;
//dp.MouseLeftButtonUp += new MouseButtonEventHandler(dataPoint_MouseLeftButtonUp);
}
//饼状图去除值为0的oildom
if ((dataSeries.RenderAs == RenderAs.Pie || dataSeries.RenderAs == RenderAs.Line) && dp.YValue == 0)
{
}
else
{
dataSeries.DataPoints.Add(dp);
}
}
}
#endregion
chart.Series.Add(dataSeries);
}
// 设置 Chart 使用自定义的颜色集合 colorset1
if (cs.Brushes.Count > 0)
{
chart.ColorSets.Clear();
chart.ColorSets.Add(cs);
chart.ColorSet = "colorset1";
}
#endregion
oGrid.Children.Add(chart);
}
}
visifire 图表双坐标轴 silverlight的更多相关文章
- silverlight 双坐标轴
public void CreateLine(Grid oGrid, string sTitle, string sTableName, bool ifGetSig, string sYUint, s ...
- 使用Visifire+ArcGIS API for Silverlight实现Graphic信息的动态图表显示
原文:使用Visifire+ArcGIS API for Silverlight实现Graphic信息的动态图表显示 首先来看一看实现的效果: PS:原始的程序中更新曲线数据时添加了过渡的效果,具体可 ...
- Origin双坐标轴图表
1.空白处右键Add New Colume添加新列 2.全选各个列绘制图表 3.添加新的Y轴图层Graph—New Layer—Right-Y 4.右键左上角图层2 –Layer Contents 绑 ...
- WPF Visifire 图表控件
Visifire WPF 图表控件 破解 可能用WPF生成过图表的开发人员都知道,WPF虽然本身的绘图能力强大,但如果每种图表都自己去实现一次的话可能工作量就大了, 尤其是在开发时间比较紧的情况下.这 ...
- MATLAB绘图,绘双坐标轴,绘一图二轴等
clc; clear all; close all; % %% 画极坐标系 % x = 0:.01 * pi:0.5 * pi; % y = cos(x) + sqrt(-1) * sin(x); % ...
- Visifire图表
引用DLL: WPFToolkit WPFVisifire.Charts.dll WPFVisifire.Gauges.dll 1.柱状图 代码: public void BindChart1() { ...
- visifire 图表属性样式设置说明,字体,阴影设置
- 修改Echarts 图表的坐标轴的文本的排列位置
option.xAxis.axisLabel['interval'] = 0 option.xAxis.axisLabel['formatter'] = function(value,index){ ...
- matlab双坐标轴设定
clc; clear all; close all; x1 = 0:.1:40; y1 = 4 * cos(x1)./(x1 + 2); x2 = 1:.2:20; y2 = x2.^2 ./ x2. ...
随机推荐
- JS 匿名函数
一.声明: 1. 正常函数声明: //正常函数声明 function foo(p1, p2){ return p1+p2; } 2. 匿名函数声明: //匿名函数声明 var foo= functio ...
- POJ3111 K Best(另类背包+二分+变态精度)
POJ3111 K Best,看讨论区说数据有点变态,精度要求较高,我就直接把循环写成了100次,6100ms过,(试了一下30,40都会wa,50是4000ms) 第一次在POJ上看到下面这种东西还 ...
- KindleRSS推送服务器搭建
参考http://xcode.so/2010/12/google-gae-rss-to-kindle/这篇文章 1.首先尝试在本机搭建服务器直接推送到kindle 需要使用到kindlereader这 ...
- 移动端-jquery Ajax执行滑动到底部进行加载 指定加载次数
过完年了,又要有新的项目了,趁暴风雨前的宁静,就把之前让我挺头疼的ajax加载给总结了一下.在此分享. 声明下:笔者对于ajax也是新手,如有更好的写法或可以优化的写法,还望指正! 项目需求: 移动端 ...
- PHP 正则表达式处理字符串的应用(一)
现有一个字符串如下: '旅行专题,旅行好玩 美好旅行;旅行真棒,一起旅行[旅行远足' 里面的分隔符号不确定,需要置换为如下: '旅行专题,旅行好玩,美好旅行,旅行真棒,一起旅行,旅行远足' 可以使用P ...
- 让C程序更高效的10种方法
http://blog.jobbole.com/1198/ 代码之美,不仅在于为一个给定问题找到解决方案,而且还在代码的简单性.有效性.紧凑性和效率(内存).代码设计比实际执行更难 .因此,每一个程序 ...
- Cmake调用NSIS(一个可执行文件,其实就是一个编译器)编译NSIS脚本问题研究
技术经理说,可以用Cmake当中的add_custom_command,add_custom_target命令来使用. 我初次研究了下,add_custom_command应该用官方文档中说明的第二种 ...
- BZOJ3016: [Usaco2012 Nov]Clumsy Cows
3016: [Usaco2012 Nov]Clumsy Cows Time Limit: 1 Sec Memory Limit: 128 MBSubmit: 71 Solved: 52[Submi ...
- cf493C Vasya and Basketball
C. Vasya and Basketball time limit per test 2 seconds memory limit per test 256 megabytes input stan ...
- hdu5080:几何+polya计数(鞍山区域赛K题)
/* 鞍山区域赛的K题..当时比赛都没来得及看(反正看了也不会) 学了polya定理之后就赶紧跑来补这个题.. 由于几何比较烂写了又丑又长的代码,还debug了很久.. 比较感动的是竟然1Y了.. * ...