/// <summary> /// 创建窗体 /// </summary> /// <param name="native">方法库</param> public LevelWindow(INativeBase native) { Load(native, "LevelWindow", "levelWindow"); RegisterEvents(m_window); m_chartLevels = GetChart("chartLevels"); m_chartLevels.HScalePixel = 20; m_chartLevels.HScaleFieldText = "日期"; CTable dataSource = m_chartLevels.DataSource; dataSource.AddColumn(0); dataSource.AddColumn(1); dataSource.AddColumn(2); dataSource.AddColumn(3); dataSource.AddColumn(4); CDiv div = m_chartLevels.AddDiv(); div.BackColor = COLOR.ARGB(255, 255, 255); div.LeftVScale.ScaleColor = COLOR.ARGB(50, 105, 217); div.HScale.ScaleColor = COLOR.ARGB(50, 105, 217); div.HGrid.GridColor = COLOR.ARGB(50, 105, 217); div.HGrid.LineStyle = 2; PolylineShape ps = new PolylineShape(); ps.FieldName = 0; ps.FieldText = "开发"; ps.FillColor = COLOR.ARGB(100, 50, 105, 217); ps.Color = COLOR.ARGB(50, 105, 217); div.AddShape(ps); PolylineShape ps2 = new PolylineShape(); ps2.FieldName = 3; ps2.FieldText = "研发"; ps2.FillColor = COLOR.ARGB(100, 255, 80, 80); ps2.Color = COLOR.ARGB(255, 80, 80); div.AddShape(ps2); PolylineShape ps3 = new PolylineShape(); ps3.FieldName = 4; ps3.FieldText = "规范"; ps3.FillColor = COLOR.ARGB(100, 80, 255, 80); ps3.Color = COLOR.ARGB(80, 255, 80); div.AddShape(ps3); PolylineShape psTop = new PolylineShape(); psTop.FieldName = 1; div.AddShape(psTop); PolylineShape psBottom = new PolylineShape(); psBottom.FieldName = 2; div.AddShape(psBottom); m_gridLevels = GetGrid("gridLevels"); m_gridLevels.RegisterEvent(new GridCellEvent(GridCellEditEnd), EVENTID.GRIDCELLEDITEND); BindLevels(); BindChart(); }
/// <summary> /// 创建指标 /// </summary> /// <param name="native">方法库</param> /// <param name="script">脚本</param> /// <param name="xml">XML</param> /// <returns>指标</returns> public static CIndicator CreateIndicator(string script, UIXml xml) { CIndicator indicator = xml.Native.CreateIndicator(); CTable table = xml.Native.CreateTable(); indicator.DataSource = table; CFunctionBase.AddFunctions(indicator); CFunctionUI.AddFunctions(indicator, xml); CFunctionWin.AddFunctions(indicator); CFunctionAjax.AddFunctions(indicator); int index = 1000000; string[] functions = FUNCTIONS.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); int functionsSize = functions.Length; for (int i = 0; i < functionsSize; i++) { indicator.AddFunction(new CFunctionEx(indicator, index + i, functions[i], xml)); } indicator.Script = script; table.AddColumn(0); table.Set(0, 0, 0); indicator.OnCalculate(0); return(indicator); }
/// <summary> /// 创建指标 /// </summary> /// <param name="id">编号</param> /// <param name="script">脚本</param> /// <param name="xml">XML</param> /// <returns>指标</returns> public static CIndicator CreateIndicator2(String id, ChatData chatData, UIXml xml) { CIndicator indicator = xml.Native.CreateIndicator(); indicator.Name = id; CTable table = xml.Native.CreateTable(); indicator.DataSource = table; indicator.Tag = chatData; CFunctionBase.AddFunctions(indicator); CFunctionUI.AddFunctions(indicator, xml); CFunctionWin.AddFunctions(indicator); int index = STARTINDEX; String[] functions = FUNCTIONS.Split(new String[] { "," }, StringSplitOptions.RemoveEmptyEntries); int functionsSize = functions.Length; for (int i = 0; i < functionsSize; i++) { indicator.AddFunction(new CFunctionEx(indicator, index + i, functions[i], xml)); } indicator.Script = chatData.m_content; table.AddColumn(0); table.Set(0, 0, 0); indicator.OnCalculate(0); return(indicator); }
/// <summary> /// 创建指标 /// </summary> /// <param name="text">脚本</param> /// <param name="parameters">参数</param> /// <returns>指标ID</returns> public static int CreateIndicatorExtern(String text, String parameters) { try { if (m_native == null) { m_native = NativeHandler.CreateNative(); } if (m_chart == null) { m_chart = new ChartAEx(); m_chart.Native = m_native; } m_serialNumber++; CTable dataSource = m_chart.Native.CreateTable(); dataSource.AddColumn(KeyFields.CLOSE_INDEX); dataSource.AddColumn(KeyFields.HIGH_INDEX); dataSource.AddColumn(KeyFields.LOW_INDEX); dataSource.AddColumn(KeyFields.OPEN_INDEX); dataSource.AddColumn(KeyFields.VOL_INDEX); dataSource.AddColumn(KeyFields.AMOUNT_INDEX); CIndicator indicator = SecurityDataHelper.CreateIndicator(m_chart, dataSource, text, parameters); m_indicators[m_serialNumber] = indicator; indicator.OnCalculate(0); } catch (Exception ex) { Console.WriteLine(ex.Message + "\r\n" + ex.StackTrace); } return(m_serialNumber); }
/// <summary> /// 创建窗体 /// </summary> /// <param name="native">方法库</param> public DialogWindow(INativeBase native) { Load(native, "DialogWindow", "dialogWindow"); RegisterEvents(m_window); m_divDialogs = GetDiv("divDialogs"); m_divDialogs.RegisterEvent(new ControlPaintEvent(PaintDiv), EVENTID.PAINT); m_gridDialogs = GetGrid("gridDialogs"); m_gridDialogs.RegisterEvent(new GridCellEvent(GridCellEditEnd), EVENTID.GRIDCELLEDITEND); BindDialogs(); m_chartLevels = GetChart("chartLevels"); m_chartLevels.HScalePixel = 20; m_chartLevels.HScaleFieldText = "日期"; CTable dataSource = m_chartLevels.DataSource; dataSource.AddColumn(0); dataSource.AddColumn(1); CDiv div = m_chartLevels.AddDiv(); div.BackColor = COLOR.ARGB(255, 255, 255); div.LeftVScale.ScaleColor = COLOR.ARGB(50, 105, 217); div.HScale.ScaleColor = COLOR.ARGB(50, 105, 217); div.HGrid.GridColor = COLOR.ARGB(50, 105, 217); div.HGrid.LineStyle = 2; PolylineShape ps = new PolylineShape(); ps.FieldName = 0; ps.FieldText = "接待量"; ps.FillColor = COLOR.ARGB(100, 50, 105, 217); ps.Color = COLOR.ARGB(50, 105, 217); div.AddShape(ps); PolylineShape psBottom = new PolylineShape(); psBottom.FieldName = 1; div.AddShape(psBottom); BindChart(); }
/// <summary> /// 创建数据源 /// </summary> /// <param name="chart">股票控件</param> /// <returns>数据源</returns> public static CTable CreateDataSource(ChartA chart) { CTable dataSource = chart.Native.CreateTable(); dataSource.AddColumn(KeyFields.CLOSE_INDEX); dataSource.AddColumn(KeyFields.HIGH_INDEX); dataSource.AddColumn(KeyFields.LOW_INDEX); dataSource.AddColumn(KeyFields.OPEN_INDEX); dataSource.AddColumn(KeyFields.VOL_INDEX); dataSource.AddColumn(KeyFields.AMOUNT_INDEX); return(dataSource); }
/// <summary> /// 创建指标 /// </summary> /// <param name="native">方法库</param> /// <param name="script">脚本</param> /// <param name="xml">XML</param> /// <returns>指标</returns> public static CIndicator CreateIndicator(String script, INativeBase native) { CIndicator indicator = native.CreateIndicator(); CTable table = native.CreateTable(); indicator.DataSource = table; CFunctionBase.AddFunctions(indicator); CFunctionHttp.AddFunctions(indicator); int index = STARTINDEX; string[] functions = FUNCTIONS.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); int functionsSize = functions.Length; for (int i = 0; i < functionsSize; i++) { indicator.AddFunction(new CFunctionEx(indicator, index + i, functions[i], native)); } indicator.Script = script; table.AddColumn(0); table.Set(0, 0, 0); indicator.OnCalculate(0); return(indicator); }