首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

有人做过股票K线图没有?怎样在自己的网站实现股票K线图?解决方法

2012-03-01 
有人做过股票K线图没有?怎样在自己的网站实现股票K线图?RT,我需要6支股票的股票K线图[解决办法]UP一下 我

有人做过股票K线图没有?怎样在自己的网站实现股票K线图?
RT,我需要6支股票的股票K线图

[解决办法]
UP一下 我也想知道呢
[解决办法]
up
[解决办法]
用activex控件可以实现,但是股票的数据不知道有没有提供web services的
[解决办法]
呵呵,我刚做好个,不过比较简单的.
[解决办法]
up
[解决办法]
给你里面的两个函数吧,整体太麻烦了.
public void AppendLine(string colname, string linecolor, int marks)
{
//个股走势
int prevX = 0, prevY = 0;
int m = chartData.Rows.Count;
for (int i = 0; i < chartData.Rows.Count; i++)
{
DataRow ds = chartData.Rows[i];
string dsk = ds[colname].ToString();
int k = Convert.ToInt32((Convert.ToDouble(ds[colname])));
int tmpx = this.xMargin + i * chartWidth / xSpan;
int tmpy = this.chartHeight + this.yMargin - Convert.ToInt32((Convert.ToDouble(ds[colname]) - minVal) / (ySpan * 1.0 / chartHeight));
if (i > 0)
{
sb.Append( " <v:line style= 'position:absolute;left:0;text-align:left;top:0;z-index:1 ' from= ' " + prevX.ToString() + ", " + prevY.ToString() + " ' to= ' " + tmpx.ToString() + ", " + tmpy.ToString() + " ' ");
sb.Append( " strokecolor= ' " + linecolor + " ' strokeweight= 'thin '> ");
sb.Append( " </v:line> ");
}
DrawMarks(marks, tmpx, tmpy, ds);
prevX = tmpx;
prevY = tmpy;
}
}
private void DrawMarks(int marks, int xPos, int yPos,DataRow dr)
{
for (int i = 1; i < marks+1; i++)
{
string mark1 = dr[ "mark "+i.ToString()].ToString();
string mark1html = dr[ "mark "+i.ToString()+ "html "].ToString();
if (mark1 != " ")
{

sb.Append( " <v:shape id= '_x0000_s1025 ' type= '#_x0000_t202 ' alt= ' " + mark1 + " ' ");
sb.Append( "style= 'position:absolute;left: " + xPos.ToString() + ";top: " + yPos.ToString() + ";width:2000;height:2000;z-index:5 '> ");
sb.Append( " <v:textbox inset= '0,0,0,0 '> ");
sb.Append( " <table cellspacing= '0 ' cellpadding= '0 ' width= '100% ' height= '100% ' > ");
sb.Append( " <tr> <td align= 'left ' style= 'cursor:hand ' title= ' " + mark1 + " '> ");
sb.Append(mark1html + " </td> </tr> </table> ");
sb.Append( " </v:textbox> </v:shape> ");
yPos -= 2000;
}
else
{
break;
}
}
}
[解决办法]
public void AppendLine(string colname, string linecolor, int marks)
{
//个股走势
int prevX = 0, prevY = 0;
int m = chartData.Rows.Count;


for (int i = 0; i < chartData.Rows.Count; i++)
{
DataRow ds = chartData.Rows[i];
string dsk = ds[colname].ToString();
int k = Convert.ToInt32((Convert.ToDouble(ds[colname])));
int tmpx = this.xMargin + i * chartWidth / xSpan;
int tmpy = this.chartHeight + this.yMargin - Convert.ToInt32((Convert.ToDouble(ds[colname]) - minVal) / (ySpan * 1.0 / chartHeight));
if (i > 0)
{
sb.Append( " <v:line style= 'position:absolute;left:0;text-align:left;top:0;z-index:1 ' from= ' " + prevX.ToString() + ", " + prevY.ToString() + " ' to= ' " + tmpx.ToString() + ", " + tmpy.ToString() + " ' ");
sb.Append( " strokecolor= ' " + linecolor + " ' strokeweight= 'thin '> ");
sb.Append( " </v:line> ");
}
DrawMarks(marks, tmpx, tmpy, ds);
prevX = tmpx;
prevY = tmpy;
}
}
private void DrawMarks(int marks, int xPos, int yPos,DataRow dr)
{
for (int i = 1; i < marks+1; i++)
{
string mark1 = dr[ "mark "+i.ToString()].ToString();
string mark1html = dr[ "mark "+i.ToString()+ "html "].ToString();
if (mark1 != " ")
{

sb.Append( " <v:shape id= '_x0000_s1025 ' type= '#_x0000_t202 ' alt= ' " + mark1 + " ' ");
sb.Append( "style= 'position:absolute;left: " + xPos.ToString() + ";top: " + yPos.ToString() + ";width:2000;height:2000;z-index:5 '> ");
sb.Append( " <v:textbox inset= '0,0,0,0 '> ");
sb.Append( " <table cellspacing= '0 ' cellpadding= '0 ' width= '100% ' height= '100% ' > ");
sb.Append( " <tr> <td align= 'left ' style= 'cursor:hand ' title= ' " + mark1 + " '> ");
sb.Append(mark1html + " </td> </tr> </table> ");
sb.Append( " </v:textbox> </v:shape> ");
yPos -= 2000;
}
else
{
break;
}
}
}
public void AppendLine(string colname,string linecolor)
{
//个股走势
int prevX = 0, prevY = 0;
for (int i = 0; i < chartData.Rows.Count; i++)
{
DataRow ds = chartData.Rows[i];
int tmpx = this.xMargin + i * chartWidth / xSpan;
int tmpy = this.chartHeight + this.yMargin - Convert.ToInt32((Convert.ToDouble(ds[colname]) - minVal) / (ySpan * 1.0 / chartHeight));
if (i > 0)
{
sb.Append( " <v:line style= 'position:absolute;left:0;text-align:left;top:0;z-index:1 ' from= ' " + prevX.ToString() + ", " + prevY.ToString() + " ' to= ' " + tmpx.ToString() + ", " + tmpy.ToString() + " ' ");
sb.Append( " strokecolor= ' "+linecolor+ " ' strokeweight= 'thin '> ");
sb.Append( " </v:line> ");
}
prevX = tmpx;
prevY = tmpy;
}
}
public void DrawChartEnd()
{
sb.Append( " </v:group> ");


}
private void ChartInit()
{
CalcYBorder();
sb=new StringBuilder();

chartHeight = 18000; //图表高度
chartWidth = 18000; //图表宽度

int xPoints = 10;
xSpan = this.chartData.Rows.Count; //数据总数
intevalX = xSpan / xPoints;//X坐标轴刻度间点数;

scaleX = (chartWidth / xSpan) * intevalX; //最好为Width值的倍数(刻度间象素)
scaleY = 3000;
countX = chartWidth / scaleX; //X轴实际点数

countY = chartHeight / scaleY;//Y轴实际点数


ySpan = maxVal - minVal; //Y轴间隔实际值

if (intevalX == 0)
{
intevalX = 1;
}
DrawChartStart();

}
private void CalcYBorder()
{
if (maxVal > 0)
{
maxVal = maxVal * 1.2;
}
else
{
maxVal = maxVal * 0.8;
}
if (minVal > 0)
{
minVal = minVal * 0.8;
}
else
{
minVal = minVal * 1.2;
}
}
}
[解决办法]
佩服楼上
[解决办法]

sb是从哪实例化来的?

[解决办法]
顶者有分,听着
[解决办法]
起码把你的datatable的格式说下,
[解决办法]
up
[解决办法]
up

[解决办法]
支持
[解决办法]
http://www.wave12.com/web/SigCon.asp?bCate=41&sCateName=K%20线图&ID=168&CateName=wsChart4.5(DLL)
[解决办法]
楼主用那些图表控件不行么?
[解决办法]
不错
[解决办法]
建议使用ComponentOne Studio Enterprise中的

WebChart,具有k线图的类型,使用起来很方便的。
[解决办法]
好像很多网站是动态生成一个图片,然后显示到Web上
[解决办法]
up
[解决办法]
学习了
[解决办法]
借人气再问个问题
2003下面的treeview控件上传到服务器后失效时怎么回事?
我把aspnet_client和webctrl_client都拷到根目录了阿,在本地正常 .
----------
aspnet_client版本或webctrl_client路径不对
[解决办法]
我做过生成图片的 ice613@sina.com
[解决办法]
建议用WebChart控件
[解决办法]
用ATGrid报表图表控件实现
www.etcell.com
[解决办法]
treeview控件上传到服务器后失效

服务器上没安装这个控件吧,得先安装一下,不行重装.2003安装常出现这个问题
------解决方案--------------------


treeview控件上传到服务器后失效时怎么回事?
===================================

可能生成的public token有错!客户端与服务器端注册此控件的时候不一样!
[解决办法]
都是高手啊
 这些问题,路过看看
UP
[解决办法]
我做过,模拟K线和月线图,后台用C#画就可以了

http://www.q22.cn/UploadFile/2007-1/20071231313377941.gif
http://www.q22.cn/UploadFile/2007-1/20071231313944433.gif 月线
http://www.q22.cn/UploadFile/2007-1/20071231314551239.gif K线
[解决办法]
teeChart For .Net 绝对棒,我刚用过

热点排行