当前位置:编程学习 > C#/ASP.NET >>

dotnetcharting 如果实现动态浏览图表 像股票那样

先上demo代码

/// Summary description for g01.
  
public class g01
{


public g01()
{
}
public void CreateChart(ref Chart  chart1)
{


// Set the title.
chart1.Title="My Chart";

// Set 3D
chart1.Use3D = true;

// Set the chart Type
chart1.Type = ChartType.Financial;

// Label the chart areas
chart1.PriceArea.Label.Text = "Stock Price for X Company";
chart1.VolumeArea.Label.Text = "Volume";

// Set the financial chart type
chart1.DefaultSeries.Type = SeriesTypeFinancial.CandleStick;

// Set the legend template
chart1.LegendBox.Template = "IconName";


// Set the directory where the images will be stored.
chart1.TempDirectory="temp";

// Set the format
chart1.VolumeArea.XAxis.FormatString = "d";

// Set the time padding for the x axis.
chart1.VolumeArea.XAxis.TimePadding = new TimeSpan(5,0,0,0);

// Set he chart size.
chart1.Width = 600;
chart1.Height = 350;

// Add the random data.
chart1.SeriesCollection.Add(g01.getData());

//
// TODO: Add any constructor code after InitializeComponent call
//
}

static private SeriesCollection getData()
{
SeriesCollection SC = new SeriesCollection();
Random myR = new Random(1);
for(int i = 0; i < 1; i++)
{


Series s = new Series();
s.Name = "X Company";
double startPrice = 50;

DateTime startDT = new DateTime(2000,1,1);
for(int b = 0; b < 75; b++)
{
Element e = new Element();
e.XDateTime = startDT;
startDT = startDT.AddDays(1);

if(myR.Next(10) > 5)
startPrice += myR.Next(5);
else
startPrice -= myR.Next(3);

e.Close = startPrice;

e.Volume = myR.Next(100);

if(myR.Next(10) > 5)
e.Open = startPrice + myR.Next(6);
else
e.Open = startPrice - myR.Next(6);

if(e.Open > e.Close)
{
e.High = e.Open + myR.Next(6);
e.Low = e.Close - myR.Next(6);
}
else
{
e.High = e.Close + myR.Next(6);
e.Low = e.Open - myR.Next(6);
}



s.Elements.Add(e);

}

SC.Add(s);

}
return(SC);


}


}

这个demo图标就跟股票图很像了 可以如何实现动态浏览呢 如按上下键后 能够动态的放大缩小 左右键能够左右平移

有人做过类似的图没
现在就是一死图

分不多 结光了再赚去 高手请帮忙下 --------------------编程问答-------------------- B帮顶 --------------------编程问答-------------------- 这个比较难 --------------------编程问答-------------------- --------------------编程问答-------------------- 很难吗 --------------------编程问答-------------------- 這個也有這樣功能,可能比較好用,

網站
补充:.NET技术 ,  C#
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,