使用图表控件基于当前和上一年填充图表 [英] populate the graph based on current and previous year using chart control

查看:75
本文介绍了使用图表控件基于当前和上一年填充图表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个数据表,其中包含2列年份和费用


我的方案是根据费用根据当前/上一年绘制图表及其费用。


我的数据示例


01-01-2011   10


01-01-2010   20


02-02-2011   30


02-02-2010   40


当我尝试将数据表绑定到我的图表输出时应


01-01-2011    10 NBSP; - 当前年度


01-01-2010    20  - 前一年


但实际上正在发生的事情是它正在绘制2010年的第一个和2011年的最后一个


在我的情况下它应该是最新的和前一年(01-01-2011和01-01-2010)


如何解决此问题。


 

解决方案

尝试设置系列'
IsXValueIndexed
属性为True。

 
Chart1.Series(0).IsXValueIndexed = True


I have a datatable which consists of 2 columns Year and Expenses

My scenario is plot the graph and its expenses based on Current/Previous Year based on expenses.

Example of my data

01-01-2011   10

01-01-2010   20

02-02-2011   30

02-02-2010   40

when i try to bind the datatable to my graph output should be

01-01-2011    10  -- current year

01-01-2010    20  -- previous year

but actually what is happening is it is plotting all the 2010 first and 2011 in last

In my case it should be current and previous year (01-01-2011 and 01-01-2010)

How to resolve this issue.

 

解决方案

Try setting the series' IsXValueIndexed property to True.

	Chart1.Series(0).IsXValueIndexed = True


这篇关于使用图表控件基于当前和上一年填充图表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆