大家好,又见面了,我是你们的朋友全栈君。
// 图表绑定辅助类
public class ChartValue : INotifyPropertyChanged
{
public ChartValue() { }
public ChartValue(string xlabel, decimal value)
{
Label = xlabel;
_yValue = value;
}
decimal _yValue;
string _label;
public event PropertyChangedEventHandler PropertyChanged;
public String Label
{
get
{
return _label;
}
set
{
_label = value;
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(“Label”));
}
}
}
public decimal YValue
{
get
{
return _yValue;
}
set
{
_yValue = value;
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(“YValue”));
}
}
}
}
//创建DataSeries(1)
public static Visifire.Charts.DataSeries CreateSerie(string title, Visifire.Charts.RenderAs RenderAsType)
{
Visifire.Charts.DataSeries myChartSeries = new Visifire.Charts.DataSeries();
myChartSeries.LegendText = title;
myChartSeries.RenderAs = RenderAsType;
myChartSeries.Cursor = Cursors.Hand;
myChartSeries.MarkerEnabled = true;
myChartSeries.MarkerType = Visifire.Commons.MarkerTypes.Circle;
Visifire.Charts.DataMapping myDataMappingX = new Visifire.Charts.DataMapping();
myDataMappingX.MemberName = “AxisXLabel”;
myDataMappingX.Path = “Label”;
Visifire.Charts.DataMapping myDataMappingY = new Visifire.Charts.DataMapping();
myDataMappingY.MemberName = “YValue”;
myDataMappingY.Path = “YValue”;
myChartSeries.DataMappings.Add(myDataMappingX);
myChartSeries.DataMappings.Add(myDataMappingY);
return myChartSeries;
}
//创建DataSeries(2)
<vc:Chart.Series>
<vc:DataSeries LegendText=”目标值” RenderAs=”Column”
Cursor=”Hand” LabelEnabled=”true” >
<vc:DataSeries.DataMappings>
<vc:DataMapping MemberName=”AxisXLabel” Path=”Label”></vc:DataMapping>
<vc:DataMapping MemberName=”YValue” Path=”YValue”></vc:DataMapping>
</vc:DataSeries.DataMappings>
</vc:DataSeries>
</vc:Chart.Series>
//legend 位置调整
<vc:Chart.Legends>
<vc:Legend VerticalAlignment=”Center” HorizontalAlignment=”Right”/>
</vc:Chart.Legends>
chart_month.ZoomingEnabled = true;//放大缩小
chart_month.IndicatorEnabled = true;//指示器
chart_month.ScrollEnable = true; //滚动条
Axis
startFromZero
转载于:https://www.cnblogs.com/xiangde112/archive/2012/11/14/2769268.html
发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/162818.html原文链接:https://javaforall.cn
【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛
【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...