asp.net chart如何生成蜡烛图

卡西莫多 2024-06-04 11:21:10
最佳回答
1打g工vs开发工具,新建一个web项目,然后再新建一个文件。2然后打开工具栏,拖动chart。3绘制如下图所示的页面。详细代码如下:<%@ reg**ter assembly="teechart" namespace="steema.teechart.web" tagprefix="tchart" %><!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head id="head1" runat="server"> <title></title> <link rel="stylesheet" type="text/css" href="../css/base.css" /> <link rel="stylesheet" type="text/css" href="../css/main.css" /> <script type="text/j**ascript" src="../js/jquery1.8.2.min.js"></script> <style type="text/css"> #updatepanel1 h2 { height: 39px; line-height: 39px; padding-top: 14px; padding-left: 18px; background: #eeab38; } </style> <script language="j**ascript" type="text/j**ascript"> function currentstyle(obj) { var objli = $("#" + obj); $("li").removeclass("current"); $(objli).addclass("current"); // $(obj).addclass("background-color", "red"); } </script></head><body> <form id="form2" runat="server"> <div class="homewarpbox"> <h2> <img src="../images/tit02.gif" alt="行情报价" title="行情报价" /></h2> <div class="glodinvest"> <div class="glodinvest_itab" style="width: 675px"> <ul> <li id="au"> <asp:button id="btnau" onclick="btnau_click" runat="server" text="黄金" style="background: none;" /> </li> <li id="ag"> <asp:button id="btnag" onclick="btnag_click" runat="server" text="白银" style="background: none;" /> </li> <li id="pt"> <asp:button id="btnpt" onclick="btnpt_click" runat="server" text="铂金" style="background: none;" /> </li> <li id="pd"> <asp:button id="btnpd" onclick="btnpd_click" runat="server" text="钯金" style="background: none;" /> </li> <li id="copper"> <asp:button id="btncopper" onclick="btncopper_click" runat="server" text="铜" style="background: none;" /> </li> <li id="uk"> <asp:button id="btnuk" onclick="btnuk_click" runat="server" text="原油" style="background: none;" /> </li> <li id="eu"> <asp:button id="btneu" onclick="btneu_click" runat="server" text="eurusd" style="background: none;" /> </li> <li id="gb"> <asp:button id="btngb" onclick="btngb_click" runat="server" text="gbpusd" style="background: none;" /> </li> <li id="eur"> <asp:button id="btneur" onclick="btneur_click" runat="server" text="eurgbp" style="background: none;" /> </li> <li id="us"> <asp:button id="btnus" onclick="btnus_click" runat="server" text="usdjpy" style="background: none;" /> </li> <li style="width: 65px" id="usd"> <asp:button id="btnusd" onclick="btnusd_click" runat="server" text="usdchf" style="background: none;" /> </li> </ul> </div> <div class="k_pai"> <asp:chart id="cpu" runat="server" width="718px" height="307" enableviewstate="true" backcolor="transparent" backgradientstyle="center" backimagewrapmode="scaled" backsecondarycolor="peachpuff" borderlinewidth="0" borderlinedashstyle="dashdot"> <series> <asp:series borderwidth="2" name="spu" shadowcolor="black" **v**ibleinlegend="false" xvaluetype="datetime" yvaluesperpoint="4" yvaluetype="double" charttype="candlestick"> </asp:series> </series> <chartareas> <asp:chartarea name="default" backcolor="254,221,191"> <ax**y **startedfromzero="false" linecolor="black"> <majorgrid enabled="false" /> </ax**y> <ax**x enabled="true" linecolor="black"> <majorgrid linecolor="transparent" /> <minorgrid linecolor="transparent" enabled="false" /> <minortickmark interval="notset" linecolor="black" /> <scalebreakstyle linecolor="transparent" /> </ax**x> </asp:chartarea> </chartareas> </asp:chart> </div> </div> </div> </form></body></html>4设置控控件属性。 <asp:chart id="cpu" runat="server" width="718px" height="307" enableviewstate="true" backcolor="transparent" backgradientstyle="center" backimagewrapmode="scaled" backsecondarycolor="peachpuff" borderlinewidth="0" borderlinedashstyle="dashdot"> <series> <asp:series borderwidth="2" name="spu" shadowcolor="black" **v**ibleinlegend="false" xvaluetype="datetime" yvaluesperpoint="4" yvaluetype="double" charttype="candlestick"> </asp:series> </series> <chartareas> <asp:chartarea name="default" backcolor="254,221,191"> <ax**y **startedfromzero="false" linecolor="black"> <majorgrid enabled="false" /> </ax**y> <ax**x enabled="true" linecolor="black"> <majorgrid linecolor="transparent" /> <minorgrid linecolor="transparent" enabled="false" /> <minortickmark interval="notset" linecolor="black" /> <scalebreakstyle linecolor="transparent" /> </ax**x> </asp:chartarea> </chartareas> </asp:chart>5增加后台相关代码6导入命名空间7增加控件处理方法8后台详细代码如下:using system;using system.collections;using system.componentmodel;using system.data;using system.drawing;using system.web;using system.web.sessionstate;using system.web.ui;using system.web.ui.webcontrols;using system.web.ui.htmlcontrols;using system.web.ui.dat****ualization.charting;using cms.bll;namespace cms.web.admin{ public partial class productk : system.web.ui.page { protected void page_load(object sender, eventargs e) { if (!th**.**postback) { pagerefresh("xauusd"); } } #region protected void btnau_click(object sender, eventargs e) { pagerefresh("xauusd"); clientscript.reg**terstartupscript(gettype(), "", "<script>currentstyle('au');</script>"); } protected void btnag_click(object sender, eventargs e) { pagerefresh("xagusd"); clientscript.reg**terstartupscript(gettype(), "", "<script>currentstyle('ag');</script>"); } protected void btnpt_click(object sender, eventargs e) { pagerefresh("xptusd"); clientscript.reg**terstartupscript(gettype(), "", "<script>currentstyle('pt');</script>"); } protected void btnpd_click(object sender, eventargs e) { pagerefresh("xpdusd"); clientscript.reg**terstartupscript(gettype(), "", "<script>currentstyle('pd');</script>"); } protected void btncopper_click(object sender, eventargs e) { pagerefresh("copper"); clientscript.reg**terstartupscript(gettype(), "", "<script>currentstyle('copper');</script>"); } protected void btnuk_click(object sender, eventargs e) { pagerefresh("ukoil"); clientscript.reg**terstartupscript(gettype(), "", "<script>currentstyle('uk');</script>"); } protected void btneu_click(object sender, eventargs e) { pagerefresh("eurusd"); clientscript.reg**terstartupscript(gettype(), "", "<script>currentstyle('eu');</script>"); } protected void btngb_click(object sender, eventargs e) { pagerefresh("gbpusd"); clientscript.reg**terstartupscript(gettype(), "", "<script>currentstyle('gb');</script>"); } protected void btneur_click(object sender, eventargs e) { pagerefresh("eurgbp"); clientscript.reg**terstartupscript(gettype(), "", "<script>currentstyle('eur');</script>"); } protected void btnus_click(object sender, eventargs e) { pagerefresh("usdjpy"); clientscript.reg**terstartupscript(gettype(), "", "<script>currentstyle('us');</script>"); } protected void btnusd_click(object sender, eventargs e) { pagerefresh("usdchf"); clientscript.reg**terstartupscript(gettype(), "", "<script>currentstyle('usd');</script>"); } #endregion private void pagerefresh(string type) { th**.cpu.viewstatecontent = serializationcontents.all; th**.cpu.enableviewstate = false; series series = cpu.series[0]; th**.fillstockdata(series, type); if (type == "eurgbp" ||type == "eurusd" || type == "usdchf" || type == "eurusd") { th**.cpu.chartareas[0].ax**y.labelstyle.format = "f4"; } else if (type == "gbpusd") { th**.cpu.chartareas[0].ax**y.labelstyle.format = "f2"; } else if (type == "usdjpy") { th**.cpu.chartareas[0].ax**y.labelstyle.format = "f3"; } else { th**.cpu.chartareas[0].ax**y.labelstyle.format = "f"; } th**.cpu.chartareas[0].ax**x.labelstyle.format = "mm-dd"; th**.cpu.chartareas[0].ax**x.labelstyle.**endlabelv**ible = false; th**.cpu.chartareas[0].ax**x.**marksnexttoax** = false; th**.cpu.chartareas[0].ax**y.labelstyle.**endlabelv**ible = false; series.borderwidth =1; series.shadowoffset = 1; // series.backsecondarycolor = color.red; series.color = color.green; th**.cpu.chartareas[0].ax**x.interval = 3; cpu.chartareas[0].ax**x.linewidth =1; } /// <summary> /// /// </summary> /// <param name="series"></param> /// <param name="period"></param> /// <param name="high"高></param> /// <param name="firstday">开始日期</param> /// <param name="type">类别</param> private void fillstockdata(series series, string type) { datatable dt = new productprice().getproducttypel**t(type); sproduct.tradeclient trade = new sproduct.tradeclient(); char splitstr = '\t'; string[] price = **; string day = string.empty; int i = 0; datetime date = datetime.now; for (int n = dt.rows.count - 1; n >= 0; n--) { day = dt.rows[n]["weektime"].tostring().substring(4, 4); day= day.insert(2, "-"); series.points.addxy(day, convert.todouble(dt.rows[n]["highprice"])); series.points[i].yvalues[1] = convert.todouble(dt.rows[n]["lowprice"]); series.points[i].yvalues[2] = convert.todouble(dt.rows[n]["openprice"]); series.points[i].yvalues[3] = convert.todouble(dt.rows[n]["closeprice"]); i = i + 1; } try { price = trade.getlastpillardata("d1", type).split(splitstr); // series.points[i].xvalue = cpu.series[0].points[i - 1].xvalue + 1; // 周期 \t 行情编码 \t 时间(yyyymmddhhmm) \t开盘价 \t最高价 \t最低价\t 收盘价\t成交量 day = price[2].substring(4, 4); day = day.insert(2, "-"); series.points.addxy(day, convert.todouble(price[4]));//dt.rows[n]["highprice"])); series.points[i].yvalues[1] = convert.todouble(price[5]);// dt.rows[n]["lowprice"]); series.points[i].yvalues[2] = convert.todouble(price[3]);//dt.rows[n]["openprice"]); series.points[i].yvalues[3] = convert.todouble(price[6]);//dt.rows[n]["closeprice"]); } catch { } } }}9运行程序end 20210311
汇率兑换计算器

类似问答
  • 股票蜡烛线怎么看?
    • 2024-06-04 07:04:23
    • 提问者: 未知
    601006大秦铁路,我不想多说,是属于傻瓜也能管好的企业。况且,目前价位偏低,长期持有肯定有的赚。600104上海汽车,在目前**,汽车还是有发展潜力,上海汽车在国内还是...
  • 股票k线的红蜡烛和绿蜡烛分别代表什么?是不是红蜡烛长得越高,就意味着股票涨得越多,缘蜡烛长代表跌
    • 2024-06-04 20:58:38
    • 提问者: 未知
    k线图又称蜡烛图,起源于日本德川幕府时代,当时日本米市商人用来记录米市的行情与价格波动,因其细腻独到的标画方式而被引入股市及期货市场。k线包含四个数据,即开盘价、最高价、最低价、收盘价。开盘价低于收盘价为红蜡烛;开盘价高于收盘价为绿蜡烛。一般情况下,红蜡烛长表示股票走势强,绿蜡烛长表示股票走势弱。
  • 股票形态指的是macd还是蜡烛图?
    • 2024-06-04 13:52:57
    • 提问者: 未知
    股票的形态是指的蜡烛图多根阴阳烛组成的形态。像macd kdj 布林带这些都属于指标。
  • 如何判别美国线和蜡烛线
    • 2024-06-04 10:12:22
    • 提问者: 未知
    1蜡烛线即通常所称的k线,根据四个主要的股票价格为基础画出,具有连贯性。每分钟,每小时,每日,每月都可以有相对于的k线。如图:为一般意义上的蜡烛线。 end1本页面未经许可获取自百度经验
  • 蜡烛线问题,红色蜡烛是阴线还是阳线?
    • 2024-06-04 07:48:45
    • 提问者: 未知
    你说的下跌 0.72%是:今天收盘价与昨天的收盘价相比 下跌了 0.72%,与日k线收阴收阳无关;如果阳线用红色表示的话,图中最后一根阳k线表示当天的收盘价格收于开盘价格之上,所以是阳线(红色)。
  • 期货 蜡烛图形态
    • 2024-06-04 04:08:33
    • 提问者: 未知
    先不讨论具体的细节蜡烛图属于技术分析的范畴,而技术分析这东西---约翰墨菲在《期货市场技术分析》中也讨论过了,建议你也看看。其实它并不是一门严谨的、可以量化的科学,而是来源于人们参与市场的经验,是一种经验的积累,也可以说是大众市场心理的另外一种表达方法,它来源于过去,而我们要用过去来预测未来。因此,“技术分析”它就会有一种主观性在里面,你也可以说它有一些“随意性”。具体到蜡烛图的形态上,“风高浪大...
  • 股市蜡烛图什么更新第二天的
    • 2024-06-04 04:15:49
    • 提问者: 未知
    不清楚你说的什么样的线是尖兵线,但是我知道捉腰带线是一根近几天以来实体很大的k线,是一根看涨的大阳线,或看跌的大阴线,见日本蜡烛图99页
  • 期货的蜡烛图 股市的蜡烛图 黄金期货的蜡烛图有什么区别知道的说一下好吗?
    • 2024-06-04 17:48:43
    • 提问者: 未知
    但一般考虑的k线图周期中期货的k线图周期比较短,比如1分钟3分钟5分钟,但股票很少考虑15分钟以下k线图。期货k线图中,有跳空是常事,但股票跳空相对少.黄金期货是期货的...
  • 学习《日本蜡烛图技术》,求解惑?
    • 2024-06-04 10:40:52
    • 提问者: 未知
    偶然溜达到这个帖子了,看了一遍。这问题下高质量的回复不少,也激起了想写点东西的欲望。先说日本蜡烛图…
  • 日本蜡烛图教程的编辑推荐
    • 2024-06-04 18:46:39
    • 提问者: 未知
    展开全部《日本蜡烛图教程》是“k线之父”史蒂夫?尼森最新力作,继《日本蜡烛图技术》之后的畅销投资经典,通过《日本蜡烛图教程》,尼森发起了一场真正的蜡烛图分析技术**。当史蒂夫·尼森通过他的经典着作将日本蜡烛图技术介绍到西方世界时,他彻底改变了西方证券投资分析方法。他发现“蜡烛图”...
汇率兑换计算器

热门推荐
热门问答
最新问答
推荐问答
新手帮助
常见问题
房贷计算器-九子财经 | 备案号: 桂ICP备19010581号-1 商务联系 企鹅:2790-680461

特别声明:本网为公益网站,人人都可发布,所有内容为会员自行上传发布",本站不承担任何法律责任,如内容有该作者著作权或违规内容,请联系我们清空删除。