后台指标计算返回数据格式说明6 - DRAWNUMBER格式

后台指标计算返回数据格式说明6 - DRAWNUMBER格式

DRAWNUMBER

画出数字.
用法:
DRAWNUMBER(COND,PRICE,NUMBER),当COND条件满足时,在PRICE位置书写数字NUMBER.
例如:
DRAWNUMBER(CLOSE/OPEN>1.08,LOW,C)表示当日实体阳线大于8%时在最低价位置显示收盘价.

返回格式说明

基础的属性这里就不说了,具体看后台指标计算返回数据格式说明1 - 基础数据格式

DrawType

“DRAWNUMBER” 固定

Type

1 固定 代表绘图函数数据类型

Draw

绘图函数输出数据

Number

数值数组

Price

数值显示的Y轴数据值,如果是null 就不显示

示例

指标脚本

DRAWNUMBER(CLOSE>OPEN,LOW,C);

json结果

{
    "Period": 0,
    "Right": 0,
    "Symbol": "600000.sh",
    "Date": [
        20201021,
        20201022,
        20201023,
        20201026,
        20201027,
        20201028,
        20201029,
        20201030,
        20201102,
        20201103,
        20201104,
        20201105,
        20201106,
        20201109,
        20201110,
        20201111,
        20201112,
        20201113,
        20201116,
        20201117
    ],
    "OutVar": [
        {
            "Name": "__temp_1__",
            "DrawType": "DRAWNUMBER",
            "Draw": {
                "Number": [
                    9.7,
                    9.65,
                    9.7,
                    9.6,
                    9.48,
                    9.4,
                    9.37,
                    9.26,
                    9.25,
                    9.3,
                    9.34,
                    9.36,
                    9.39,
                    9.43,
                    9.46,
                    9.56,
                    9.43,
                    9.36,
                    9.45,
                    9.53
                ],
                "Price": [
                    9.51,
                    null,
                    9.62,
                    null,
                    null,
                    null,
                    9.34,
                    null,
                    null,
                    null,
                    null,
                    null,
                    9.33,
                    9.39,
                    null,
                    9.44,
                    null,
                    null,
                    9.37,
                    9.44
                ]
            },
            "Type": 1,
            "Attribute": [
                "NONE_OUT_NAME"
            ],
            "Attribute2": {
                "Function": "DRAWNUMBER"
            }
        }
    ]
}

QQ群: 950092318

如果还有问题可以加交流QQ群: 950092318

HQChart代码地址

地址:github.com/jones2000/HQChart

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
以下是一个简单的示例代码,可以在 stm32f103c8t6 上使用 VGA 显示一串数字: ```c #include "stm32f10x.h" #define HSYNC_PIN GPIO_Pin_0 #define HSYNC_PORT GPIOA #define VSYNC_PIN GPIO_Pin_1 #define VSYNC_PORT GPIOA #define COLOR_PIN GPIO_Pin_2 #define COLOR_PORT GPIOA #define HSYNC_TIM TIM2 #define HSYNC_TIM_RCC RCC_APB1Periph_TIM2 #define VGA_H_PIXELS 640 #define VGA_H_FRONT_PORCH 16 #define VGA_H_SYNC_PULSE 96 #define VGA_H_BACK_PORCH 48 #define VGA_H_TOTAL (VGA_H_PIXELS + VGA_H_FRONT_PORCH + VGA_H_SYNC_PULSE + VGA_H_BACK_PORCH) #define VGA_V_PIXELS 480 #define VGA_V_FRONT_PORCH 10 #define VGA_V_SYNC_PULSE 2 #define VGA_V_BACK_PORCH 33 #define VGA_V_TOTAL (VGA_V_PIXELS + VGA_V_FRONT_PORCH + VGA_V_SYNC_PULSE + VGA_V_BACK_PORCH) void VGA_Init(void); void VGA_DrawPixel(uint16_t x, uint16_t y, uint16_t color); void VGA_DrawChar(uint16_t x, uint16_t y, uint8_t c, uint16_t color); void VGA_DrawString(uint16_t x, uint16_t y, char* str, uint16_t color); void VGA_DrawNumber(uint16_t x, uint16_t y, uint32_t num, uint16_t color); void VGA_HSyncHandler(void); void VGA_VSyncHandler(void); volatile uint16_t vga_frame_buffer[VGA_V_TOTAL][VGA_H_TOTAL]; int main(void) { SystemInit(); VGA_Init(); while (1) { VGA_DrawNumber(VGA_H_PIXELS / 2 - 40, VGA_V_PIXELS / 2 - 8, 12345678, 0xFFFF); } } void VGA_Init(void) { GPIO_InitTypeDef GPIO_InitStructure; TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure; TIM_OCInitTypeDef TIM_OCInitStructure; NVIC_InitTypeDef NVIC_InitStructure; RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE); GPIO_InitStructure.GPIO_Pin = HSYNC_PIN; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; GPIO_Init(HSYNC_PORT, &GPIO_InitStructure); GPIO_InitStructure.GPIO_Pin = VSYNC_PIN; GPIO_Init(VSYNC_PORT, &GPIO_InitStructure); GPIO_InitStructure.GPIO_Pin = COLOR_PIN; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_Init(COLOR_PORT, &GPIO_InitStructure); RCC_APB1PeriphClockCmd(HSYNC_TIM_RCC, ENABLE); TIM_TimeBaseStructure.TIM_Period = VGA_H_TOTAL - 1; TIM_TimeBaseStructure.TIM_Prescaler = 72 - 1; TIM_TimeBaseStructure.TIM_ClockDivision = TIM_CKD_DIV1; TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up; TIM_TimeBaseInit(HSYNC_TIM, &TIM_TimeBaseStructure); TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_PWM1; TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable; TIM_OCInitStructure.TIM_Pulse = VGA_H_SYNC_PULSE; TIM_OCInitStructure.TIM_OCPolarity = TIM_OCPolarity_High; TIM_OC1Init(HSYNC_TIM, &TIM_OCInitStructure); TIM_ITConfig(HSYNC_TIM, TIM_IT_Update, ENABLE); NVIC_InitStructure.NVIC_IRQChannel = TIM2_IRQn; NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0; NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0; NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; NVIC_Init(&NVIC_InitStructure); TIM_Cmd(HSYNC_TIM, ENABLE); } void VGA_DrawPixel(uint16_t x, uint16_t y, uint16_t color) { vga_frame_buffer[y][x] = color; } void VGA_DrawChar(uint16_t x, uint16_t y, uint8_t c, uint16_t color) { uint8_t i, j; for (i = 0; i < 8; i++) { for (j = 0; j < 6; j++) { if ((Font6x8[c][j] >> i) & 0x01) { VGA_DrawPixel(x + j, y + i, color); } } } } void VGA_DrawString(uint16_t x, uint16_t y, char* str, uint16_t color) { while (*str != '\0') { VGA_DrawChar(x, y, *str++, color); x += 6; } } void VGA_DrawNumber(uint16_t x, uint16_t y, uint32_t num, uint16_t color) { char str[10]; sprintf(str, "%lu", num); VGA_DrawString(x, y, str, color); } void VGA_HSyncHandler(void) { static uint16_t h_count = 0; if (h_count < VGA_H_PIXELS) { GPIO_WriteBit(COLOR_PORT, COLOR_PIN, (BitAction)(vga_frame_buffer[VGA_V_TOTAL - 1][h_count] >> 15)); GPIO_WriteBit(COLOR_PORT, COLOR_PIN, (BitAction)(vga_frame_buffer[VGA_V_TOTAL - 1][h_count] >> 14)); GPIO_WriteBit(COLOR_PORT, COLOR_PIN, (BitAction)(vga_frame_buffer[VGA_V_TOTAL - 1][h_count] >> 13)); GPIO_WriteBit(COLOR_PORT, COLOR_PIN, (BitAction)(vga_frame_buffer[VGA_V_TOTAL - 1][h_count] >> 12)); GPIO_WriteBit(COLOR_PORT, COLOR_PIN, (BitAction)(vga_frame_buffer[VGA_V_TOTAL - 1][h_count] >> 11)); GPIO_WriteBit(COLOR_PORT, COLOR_PIN, (BitAction)(vga_frame_buffer[VGA_V_TOTAL - 1][h_count] >> 10)); GPIO_WriteBit(COLOR_PORT, COLOR_PIN, (BitAction)(vga_frame_buffer[VGA_V_TOTAL - 1][h_count] >> 9)); GPIO_WriteBit(COLOR_PORT, COLOR_PIN, (BitAction)(vga_frame_buffer[VGA_V_TOTAL - 1][h_count] >> 8)); GPIO_WriteBit(COLOR_PORT, COLOR_PIN, (BitAction)(vga_frame_buffer[VGA_V_TOTAL - 1][h_count] >> 7)); GPIO_WriteBit(COLOR_PORT, COLOR_PIN, (BitAction)(vga_frame_buffer[VGA_V_TOTAL - 1][h_count] >> 6)); GPIO_WriteBit(COLOR_PORT, COLOR_PIN, (BitAction)(vga_frame_buffer[VGA_V_TOTAL - 1][h_count] >> 5)); GPIO_WriteBit(COLOR_PORT, COLOR_PIN, (BitAction)(vga_frame_buffer[VGA_V_TOTAL - 1][h_count] >> 4)); GPIO_WriteBit(COLOR_PORT, COLOR_PIN, (BitAction)(vga_frame_buffer[VGA_V_TOTAL - 1][h_count] >> 3)); GPIO_WriteBit(COLOR_PORT, COLOR_PIN, (BitAction)(vga_frame_buffer[VGA_V_TOTAL - 1][h_count] >> 2)); GPIO_WriteBit(COLOR_PORT, COLOR_PIN, (BitAction)(vga_frame_buffer[VGA_V_TOTAL - 1][h_count] >> 1)); GPIO_WriteBit(COLOR_PORT, COLOR_PIN, (BitAction)vga_frame_buffer[VGA_V_TOTAL - 1][h_count]); } h_count++; if (h_count >= VGA_H_TOTAL) { h_count = 0; TIM_ClearITPendingBit(HSYNC_TIM, TIM_IT_Update); VGA_VSyncHandler(); } } void VGA_VSyncHandler(void) { static uint16_t v_count = 0; if (v_count < VGA_V_PIXELS) { v_count++; } if (v_count == VGA_V_FRONT_PORCH) { GPIO_WriteBit(VSYNC_PORT, VSYNC_PIN, Bit_RESET); } if (v_count == VGA_V_FRONT_PORCH + VGA_V_SYNC_PULSE) { GPIO_WriteBit(HSYNC_PORT, HSYNC_PIN, Bit_RESET); } if (v_count == VGA_V_FRONT_PORCH + VGA_V_SYNC_PULSE + VGA_V_BACK_PORCH) { GPIO_WriteBit(HSYNC_PORT, HSYNC_PIN, Bit_SET); } if (v_count == VGA_V_TOTAL - 1) { v_count = 0; GPIO_WriteBit(VSYNC_PORT, VSYNC_PIN, Bit_SET); } } void TIM2_IRQHandler(void) { if (TIM_GetITStatus(HSYNC_TIM, TIM_IT_Update) != RESET) { TIM_ClearITPendingBit(HSYNC_TIM, TIM_IT_Update); VGA_HSyncHandler(); } } ``` 注意,此代码仅显示数字,您需要在代码中添加更多功能来实现您的需求。此外,您还需要将 STM32F103C8T6 连接到 VGA 显示器,以便显示输出。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

HQChart

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值