Example #1
0
        override public void render(xGraphics g)
        {
            g.setColor(C.COLOR_BLACK);
            g.clear();
            //  title
            String title = "";

            if (mChartType == BUBBLE_TRADE_MONEY)
            {
                title = "Đồ thị minh họa luồng tiền (Mã / Giá trị GD / Thay đổi giá)";
            }
            else if (mChartType == BUBBLE_VOLUME_WEIGHT)
            {
                title = "Đồ thị minh họa mức độ ảnh hưởng (Mã / Trọng số / Thay đổi giá)";
            }
            else if (mChartType == BUBBLE_INDEX_WEIGHT_RATIO_INC)
            {
                title = "Tốp mã làm tăng thị trường (Mã / Thay đổi index / Thay đổi giá)";
            }
            else if (mChartType == BUBBLE_INDEX_WEIGHT_RATIO_DEC)
            {
                title = "Tốp mã làm giảm thị trường (Mã / Thay đổi index / Thay đổi giá)";
            }
            Font f = mContext.getFontText();

            g.setColor(C.COLOR_WHITE);
            g.drawString(f, title, 10, 2, xGraphics.TOP | xGraphics.LEFT);

            for (int i = 0; i < mUsedBlocks.size(); i++)
            {
                stBubbleBlock b = (stBubbleBlock)mUsedBlocks.elementAt(i);
                drawBlock(g, b);
            }
        }
        override public void render(xGraphics g)
        {
            g.setColor(C.COLOR_BLACK);
            g.clear();

            if (isProcessing)
            {
                g.setColor(C.COLOR_ORANGE);
                g.drawStringInRect(mContext.getFontSmallB(), "Đang xử lý", 0, 0, getW(), getH(), xGraphics.HCENTER | xGraphics.VCENTER);
                return;
            }
            //  title
            String title  = "";
            String prefix = mMarketID == 1 ? "[VNX] " : "[HNX] ";

            if (mChartType == BUBBLE_TRADE_MONEY)
            {
                title = prefix + "Luồng tiền (Mã; Thay đổi giá; Giá trị GD)";
            }
            else if (mChartType == BUBBLE_VOLUME_WEIGHT)
            {
                title = prefix + "Mức độ ảnh hưởng (Mã; Thay đổi giá; Trọng số)";
            }
            else if (mChartType == BUBBLE_INDEX_WEIGHT_RATIO_INC)
            {
                title = prefix + "Tăng Index (Mã; Thay đổi giá; Thay đổi điểm)";
            }
            else if (mChartType == BUBBLE_INDEX_WEIGHT_RATIO_DEC)
            {
                title = prefix + "Giảm Index (Mã; Thay đổi giá; Thay đổi điểm)";
            }
            Font f = mContext.getFontText();

            g.setColor(C.COLOR_WHITE);
            g.drawString(f, title, 10, 2, xGraphics.TOP | xGraphics.LEFT);

            for (int i = 0; i < mUsedBlocks.size(); i++)
            {
                stStatisticsBlock b = (stStatisticsBlock)mUsedBlocks.elementAt(i);
                if (b.w > 0)
                {
                    drawBlock(g, b);
                }
            }
        }
Example #3
0
        public override void render(xGraphics g)
        {
            if (isFocus())
            {
                g.setColor(0xff306AC5);
            }
            else
            {
                g.setColor(C.COLOR_BLACK);
            }
            g.clear();
            g.setColor(0xffffffff);
            g.drawLine(0, getH() - 1, getW(), getH() - 1);
            stPriceboardStateIndex pi = mContext.mPriceboard.getPriceboardIndexOfMarket(mMarketID);

            if (pi == null /* || pi.current_point == 0*/)
            {
                return;
            }

            //===========================================
            //  VNIndex 375.3 (-1.86, -0.49%)   KL: 37,716,548 GT: 560.9 ty     up:84 no:53 down:169
            //===========================================
            int  x = 0;
            int  y = 0;
            uint color;

            g.setColor(C.COLOR_WHITE);
            g.drawString(mFont, pi.code, x, y);

            x = 75;

            if (pi.changed_point > 0)
            {
                color = C.COLOR_GREEN;
            }
            else if (pi.changed_point < 0)
            {
                color = C.COLOR_RED;
            }
            else
            {
                color = C.COLOR_YELLOW;
            }
            g.setColor(color);

            String s;

            s = String.Format("{0:F2}", pi.current_point);
            //  point
            g.drawString(mFont, s, x, y);
            x = 130;
            //  change
            String        s1             = String.Format("{0:F2}", pi.changed_point);
            float         changedPercent = (pi.changed_point * 100) / pi.current_point;
            String        s2             = String.Format("{0:F2}%", changedPercent);
            StringBuilder sb             = Utils.sb;

            sb.Length = 0;
            sb.AppendFormat("({0}, {1})", s1, s2);
            s = sb.ToString();
            g.drawString(mFont, s, x, y);
            x = 220;
            //  KL
            g.setColor(C.COLOR_WHITE);
            double t = pi.total_volume;

            t /= 1000000;
            //s =
            s = Utils.formatNumber((float)t, 2);
            //Utils.formatNumber(0, 1);
            sb.Length = 0;
            sb.AppendFormat("KLGD: {0} tr", s);
            g.drawString(mFont, sb.ToString(), x, y);

            x = 330;
            //  GT
            s         = Utils.formatDecimalNumber(pi.totalGTGD, 1000, 1);
            sb.Length = 0;
            sb.AppendFormat("GTGD: {0} tỷ", s);
            g.drawString(mFont, sb.ToString(), x, y);

            x = 440;

            //  up/none/down
            int frmW = mArrows.Width / 3;
            int frmH = mArrows.Height;

            g.drawImage(mArrows, x, y, frmW, frmH, 0, 0);
            x += frmW + 2;
            g.setColor(C.COLOR_GREEN);
            g.drawString(mFont, "" + pi.inc_cnt, x, y);
            x += 40;
            //  none
            g.drawImage(mArrows, x, y, frmW, frmH, 2 * frmW, 0);
            x += frmW + 2;
            g.setColor(C.COLOR_YELLOW);
            g.drawString(mFont, "" + pi.ref_num, x, y);
            x += 40;
            //  down
            g.drawImage(mArrows, x, y, frmW, frmH, frmW, 0);
            x += frmW + 2;
            g.setColor(C.COLOR_RED);
            g.drawString(mFont, "" + pi.dec_cnt, x, y);
            //  date

            x += 50;

            //  cung-cau
            g.setColor(C.COLOR_WHITE);

            double[] tt = { 0, 0 };
            calcBuySellRemains(pi.marketID, tt);
            //  mua
            t = tt[0] / 1000000;
            s = Utils.formatNumber((float)t, 1);
            //  ban
            t         = tt[1] / 1000000;
            s1        = Utils.formatNumber((float)t, 1);
            sb.Length = 0;
            sb.AppendFormat("Dư M/B={0} / {1}", s, s1);
            g.drawString(mFont, sb.ToString(), x, y);

            x += 150;

            g.setColor(C.COLOR_WHITE);
            g.drawString(mFont, pi.mDate, x, y);
        }
        override public void render(xGraphics g)
        {
            //=========================
            if (viewState == VIEWSTATE_1_NHOMNGANH && chartG != null)
            {
                chartG.render(g);
                return;
            }

            g.setColor(C.COLOR_BLACK);
            g.clear();

            if (isProcessing)
            {
                g.setColor(C.COLOR_ORANGE);
                g.drawStringInRect(mContext.getFontSmallB(), "Đang xử lý", 0, 0, getW(), getH(), xGraphics.HCENTER | xGraphics.VCENTER);
                return;
            }

            //  title
            //      [Hom nay] [1 Tuan] [1 Thang] [3 thang] [1 nam]
            //          Tang          |          Giam          |
            //  VN30: +15%; GTDG: 30.1ti    .Chart
            //
            if (mChanges.size() == 0)
            {
                calcChanged(mPeriod);
            }
            if (mChanges.size() == 0)
            {
                return;
            }


            float x, y;
            int   buttonW = 80;
            int   buttonH = 26;

            int gap = 4;

            x = (getW() - 6 * (buttonW + gap)) / 2;

            //  button
            y = 2;
            mButtonPositions.removeAllElements();
            mPeriods.removeAllElements();
            string[] buttons = { "1 Ngày", "1 Tuần", "1 Tháng", "3 Tháng", "6 Tháng", "1 Năm" };
            int[]    periods = { 1, 5, 22, 67, 130, 260 };
            for (int i = 0; i < buttons.Length; i++)
            {
                string s = buttons[i];
                g.setColor(C.COLOR_GRAY_LIGHT);
                g.drawRect((int)x, 2, buttonW, buttonH);
                g.setColor(mPeriod == periods[i]?C.COLOR_ORANGE:C.COLOR_WHITE);
                g.drawStringInRect(mContext.getFontSmallB(), s, (int)x, (int)y, buttonW, buttonH, xGraphics.HCENTER | xGraphics.VCENTER);

                Rectangle rc = new Rectangle((int)x, 2, buttonW, buttonH);
                mButtonPositions.addElement(rc);
                mPeriods.addElement(periods[i]);

                x += buttonW + gap;
            }

            g.setColor(C.COLOR_GRAY_DARK);
            g.drawHorizontalLine(0, buttonH + 4, getW());

            int    columnH    = ItemH;
            double maxPercent = 0;

            for (int i = 0; i < mChanges.size(); i++)
            {
                GroupChanges gc = (GroupChanges)mChanges.elementAt(i);
                if (Math.Abs(gc.changedPercent) > maxPercent)
                {
                    maxPercent = Math.Abs(gc.changedPercent);
                }
            }
            //--------------------
            int buttonY = 30;
            int drawH   = getH() - buttonY;

            ItemH = getItemH(getH() - 40, mChanges.size());

            float cellW = getW() / 2;
            float cellH = ItemH;

            maxPercent *= 1.15;
            //  Left side
            int j = 0;

            y = buttonY + 4;

            int itemPerColumn = mChanges.size() / 2;

            for (int i = 0; i < itemPerColumn; i++)
            {
                GroupChanges gc = (GroupChanges)mChanges.elementAt(i);
                x = 2;
                //if (gc.changedPercent >= 0)
                {
                    y     = buttonY + 4 + j * cellH;
                    cellW = (float)((Math.Abs(gc.changedPercent) / maxPercent) * getW() / 2);
                    g.setColor(gc.changedPercent > 0?C.COLOR_GREEN_DARK:C.COLOR_RED);
                    g.fillRectF(x, y, cellW, cellH - 2);

                    //  text
                    g.setColor(C.COLOR_WHITE);
                    if (gc.changedPercent >= 0)
                    {
                        string s = String.Format("{0} +{1:F2} %", gc.code, gc.changedPercent);
                        g.drawString(mContext.getFontText(), s, (int)x, (int)(y + cellH / 2), xGraphics.VCENTER);
                    }
                    else
                    {
                        string s = String.Format("{0} {1:F2} %", gc.code, gc.changedPercent);
                        g.drawString(mContext.getFontText(), s, (int)x, (int)(y + cellH / 2), xGraphics.VCENTER);
                    }
                    j++;

                    gc.x = (int)x;
                    gc.y = (int)y;
                    gc.w = (int)getW() / 2 - 10;
                    gc.h = (int)cellH;
                }
            }
            g.setColor(C.COLOR_GRAY_DARK);
            g.drawVerticalLine(getW() / 2, buttonY, getH());
            //  Right side
            j = 0;
            for (int i = itemPerColumn; i < mChanges.size(); i++)
            {
                GroupChanges gc = (GroupChanges)mChanges.elementAt(i);
                x = getW() / 2 + 2;
                //if (gc.changedPercent < 0)
                {
                    y     = buttonY + 4 + j * cellH;
                    cellW = (float)((Math.Abs(gc.changedPercent) / maxPercent) * getW() / 2);
                    g.setColor(gc.changedPercent > 0 ? C.COLOR_GREEN_DARK : C.COLOR_RED);
                    g.fillRectF(x, y, cellW, cellH - 2);

                    //  text
                    g.setColor(C.COLOR_WHITE);
                    if (gc.changedPercent >= 0)
                    {
                        string s = String.Format("{0}: +{1:F2} %", gc.code, gc.changedPercent);
                        g.drawString(mContext.getFontText(), s, (int)x, (int)(y + cellH / 2), xGraphics.VCENTER);
                    }
                    else
                    {
                        string s = String.Format("{0}: {1:F2} %", gc.code, gc.changedPercent);
                        g.drawString(mContext.getFontText(), s, (int)x, (int)(y + cellH / 2), xGraphics.VCENTER);
                    }
                    j++;

                    gc.x = (int)x;
                    gc.y = (int)y;
                    gc.w = (int)getW() / 2 - 10;
                    gc.h = (int)cellH;
                }
            }
        }
Example #5
0
        public override void render(xGraphics g)
        {
            g.setColor(C.COLOR_BLACK);
            g.clear();

            stPriceboardState ps = mContext.mPriceboard.getPriceboard(mAlarm.code);

            if (ps == null)
            {
                return;
            }

            Font f = mContext.getBigFont();
            int  x = 0;
            int  y = 0;

            //  code
            x = 4;
            y = (getH() - f.Height) / 2 - 4;
            g.setColor(C.COLOR_WHITE);
            g.drawString(f, mAlarm.code, x, y - 4);

            x += 120;
            //  gia hien tai
            drawQuotePoint(g, x);

            x += 120;

            //  upper alarm
            int ch = getH() / 2 - 5;

            f = mContext.getFontText();
            y = (ch - f.Height) / 2;
            int x0 = drawThreahold(g, x, y, true);   //  upper

            y = ch + (ch - f.Height) / 2;
            int x1 = drawThreahold(g, x, y, false);   //  lower

            x = x0 > x1? x0 + 2:x1 + 2;
            //=========================================
            int alarm = mAlarm.hasAlarm();

            if (alarm != 0)
            {
                String s;
                if (alarm == 1)
                {
                    s = "Giá đã vượt lên trên " + Utils.formatNumber(mAlarm.upperPrice);
                    g.setColor(C.COLOR_GREEN);
                    y = (ch - mAlarmImage.Height) / 2;
                }
                else
                {
                    s = "Giá đã xuống thấp hơn " + Utils.formatNumber(mAlarm.lowerPrice);
                    g.setColor(C.COLOR_RED);
                    y = ch + (ch - mAlarmImage.Height) / 2;
                }
                if (mShowingAlarm)
                {
                    g.drawImage(mAlarmImage, x, y);
                }
                g.drawString(f, s, x + mAlarmImage.Width + 10, y + 2);
            }

            if (mAlarm.comment != null && mAlarm.comment.Length > 0)
            {
                y = getH() - f.Height - 1;
                g.setColor(C.COLOR_YELLOW);
                g.drawString(mContext.getFontTextItalic(), "(" + mAlarm.comment + ")", 8, y);
            }

            //=======================
            g.setColor(C.COLOR_WHITE);
            g.drawHorizontalLine(0, getH() - 1, getW());
        }
Example #6
0
        override public void render(xGraphics g)
        {
            g.setColor(C.COLOR_BLACK);
            g.clear();

            if (isProcessing)
            {
                g.setColor(C.COLOR_ORANGE);
                g.drawStringInRect(mContext.getFontSmallB(), "Đang xử lý", 0, 0, getW(), getH(), xGraphics.HCENTER | xGraphics.VCENTER);
                return;
            }

            if (onBack != null)
            {
                g.setColor(C.COLOR_ORANGE);
                g.drawString(mContext.getFontSmall(), "<<<BACK", 10, 4);
            }
            if (onHistoryClick != null)
            {
                g.setColor(C.COLOR_ORANGE);
                g.drawString(mContext.getFontSmall(), ">>>Đồ Thị", getW() - 10, 4, xGraphics.RIGHT);
            }

            //  title
            //      [Hom nay] [1 Tuan] [1 Thang] [3 thang] [1 nam]
            //          Tang          |          Giam          |
            //  VN30: +15%; GTDG: 30.1ti    ->Chart
            //
            if (mChanges.size() == 0)
            {
                calcChanged(mPeriod);
            }
            if (mChanges.size() == 0)
            {
                return;
            }


            float x, y;
            int   buttonW = 76;
            int   buttonH = 26;

            int gap = 4;

            x = (getW() - 6 * (buttonW + gap)) / 2;

            //  button
            y = 2;
            mButtonPositions.removeAllElements();
            mPeriods.removeAllElements();
            string[] buttons = { "1 Ngày", "1 Tuần", "1 Tháng", "3 Tháng", "6 Tháng", "1 Năm" };
            int[]    periods = { 1, 5, 22, 67, 130, 260 };
            for (int i = 0; i < buttons.Length; i++)
            {
                string s = buttons[i];
                g.setColor(C.COLOR_GRAY_LIGHT);
                g.drawRect((int)x, 2, buttonW, buttonH);
                g.setColor(mPeriod == periods[i]?C.COLOR_ORANGE:C.COLOR_WHITE);
                g.drawStringInRect(mContext.getFontSmallB(), s, (int)x, (int)y, buttonW, buttonH, xGraphics.HCENTER | xGraphics.VCENTER);

                Rectangle rc = new Rectangle((int)x, 2, buttonW, buttonH);
                mButtonPositions.addElement(rc);
                mPeriods.addElement(periods[i]);

                x += buttonW + gap;
            }

            g.setColor(C.COLOR_GRAY_DARK);
            g.drawHorizontalLine(0, buttonH + 4, getW());

            int numberOfColumns   = 4;
            int maxItemPerColumns = mChanges.size() / numberOfColumns;

            if ((mChanges.size() % numberOfColumns) != 0)
            {
                maxItemPerColumns++;
            }

            ItemH = (getH() - 40) / maxItemPerColumns;

            int   columnH    = ItemH;
            float maxPercent = 0;

            for (int i = 0; i < mChanges.size(); i++)
            {
                ShareChanges gc = (ShareChanges)mChanges.elementAt(i);
                if (Math.Abs(gc.changedPercent) > maxPercent)
                {
                    maxPercent = (float)Math.Abs(gc.changedPercent);
                }
            }
            //--------------------
            int buttonY = 30;

            columnH = ItemH;
            float cellW = getW() / numberOfColumns;
            float cellH = ItemH;

            maxPercent *= 1.15f;
            //  Left side
            int j = 0;

            y = buttonY + 4;

            int itemPerColumn = maxItemPerColumns;

            x = 2;

            drawItems(0, maxItemPerColumns, x, y, cellW, columnH, maxPercent, numberOfColumns, g);
            x += getW() / numberOfColumns;

            drawItems(maxItemPerColumns, maxItemPerColumns, x, y, cellW, columnH, maxPercent, numberOfColumns, g);
            x += getW() / numberOfColumns;

            drawItems(2 * maxItemPerColumns, maxItemPerColumns, x, y, cellW, columnH, maxPercent, numberOfColumns, g);
            x += getW() / numberOfColumns;

            drawItems(3 * maxItemPerColumns, maxItemPerColumns, x, y, cellW, columnH, maxPercent, numberOfColumns, g);
        }
Example #7
0
        public override void render(xGraphics g)
        {
            g.setColor(C.COLOR_BLACK);
            g.clear();
            g.setColor(0xffffffff);
            g.drawLine(0, 0, 0, getH());
            stPriceboardStateIndex pi = mContext.mPriceboard.getPriceboardIndexOfMarket(mMarketID);

            if (pi == null || pi.current_point == 0)
            {
                return;
            }

            //===========================================
            //  VNIndex 375.3 (-1.86, -0.49%)   KL: 37,716,548 GT: 560.9 ty     up:84 no:53 down:169
            //===========================================
            int lineH = 20;

            int  x0 = 4;
            int  x  = x0;
            int  y  = 0;
            uint color;

            g.setColor(C.COLOR_WHITE);

            Font fTitle = mContext.getFontTextItalic();

            //  date
            x = x0;
            g.setColor(C.COLOR_WHITE);
            g.drawString(fTitle, pi.mDate, x, y);
            y += lineH;
            //==============================
            //  VNINDEX
            g.drawString(mFont, pi.code, x, y);
            //======point

            if (pi.changed_point > 0)
            {
                color = C.COLOR_GREEN;
            }
            else if (pi.changed_point < 0)
            {
                color = C.COLOR_RED;
            }
            else
            {
                color = C.COLOR_YELLOW;
            }
            g.setColor(color);

            String s;

            s = String.Format("{0:F2}", pi.current_point);
            //  point
            x += g.getStringWidth(mFont, pi.code) + 10;
            g.drawString(mFont, s, x, y);

            //  change
            g.setColor(C.COLOR_WHITE);
            y += lineH + 10;
            g.drawString(fTitle, "Thay đổi: ", x0, y);

            x = x0 + g.getStringWidth(fTitle, "Thay đổi: ") + 6;
            g.setColor(color);
            //  change
            String        s1             = String.Format("{0:F2}", pi.changed_point);
            float         changedPercent = (pi.changed_point * 100) / pi.current_point;
            String        s2             = String.Format("{0:F2}", changedPercent);
            StringBuilder sb             = Utils.sb;

            sb.Length = 0;
            sb.AppendFormat("({0}, {1} %)", s1, s2);
            s = sb.ToString();
            g.drawString(mFont, s, x, y);

            x  = x0;
            y += lineH + 10;
            //  KL
            g.setColor(C.COLOR_WHITE);
            double t = pi.total_volume;

            t /= 1000000;
            //s =
            s = Utils.formatNumber((float)t, 2);
            //Utils.formatNumber(0, 1);
            sb.Length = 0;
            sb.AppendFormat("KLGD: {0} tr", s);
            g.drawString(mFont, sb.ToString(), x, y);

            x  = x0;
            y += lineH;
            //  GT
            s         = Utils.formatDecimalNumber(pi.totalGTGD, 1000, 1);
            sb.Length = 0;
            sb.AppendFormat("GTGD: {0} tỷ", s);
            g.drawString(mFont, sb.ToString(), x, y);

            x  = x0;
            y += lineH;
            //  cung-cau
            g.setColor(C.COLOR_WHITE);

            double[] tt = { 0, 0 };
            calcBuySellRemains(pi.marketID, tt);
            //  mua
            t = tt[0] / 1000000;
            s = Utils.formatNumber((float)t, 1);
            //  ban
            t         = tt[1] / 1000000;
            s1        = Utils.formatNumber((float)t, 1);
            sb.Length = 0;
            sb.AppendFormat("Dư mua/bán (tr): {0} / {1}", s, s1);
            g.drawString(mFont, sb.ToString(), x, y);

            x = x0;

            y += lineH + 10;

            g.setColor(C.COLOR_WHITE);
            g.drawString(fTitle, "Số mã tăng/giảm:", x, y);
            y += lineH;
            //  up/none/down
            int frmW = mArrows.Width / 3;
            int frmH = mArrows.Height;

            g.drawImage(mArrows, x, y, frmW, frmH, 0, 0);
            x += frmW + 2;
            g.setColor(C.COLOR_GREEN);
            g.drawString(mFont, "" + pi.inc_cnt, x, y);
            x += 40;
            //  none
            g.drawImage(mArrows, x, y, frmW, frmH, 2 * frmW, 0);
            x += frmW + 2;
            g.setColor(C.COLOR_YELLOW);
            g.drawString(mFont, "" + pi.floor_cnt, x, y);
            x += 40;
            //  down
            g.drawImage(mArrows, x, y, frmW, frmH, frmW, 0);
            x += frmW + 2;
            g.setColor(C.COLOR_RED);
            g.drawString(mFont, "" + pi.dec_cnt, x, y);

            //===========cao:
            x = x0;
            g.setColor(C.COLOR_YELLOW);
            TradeHistory trade = mContext.getTradeHistory(pi.id);

            //  referent
            s  = String.Format("{0:F2}", pi.reference);
            y += lineH + 10;
            s  = "Tham chiếu: " + s;
            //fTitle = mContext.getFon
            g.drawString(mFont, s, x, y);
            //  cao
            s  = String.Format("{0:F2}", trade.mHighest);
            y += lineH;
            s  = "Cao nhất: " + s;
            g.drawString(mFont, s, x, y);

            //  thap
            s  = String.Format("{0:F2}", trade.mLowest);
            y += lineH;
            s  = "Thấp nhất: " + s;
            g.drawString(mFont, s, x, y);
        }
Example #8
0
        override public void render(xGraphics g)
        {
            g.setColor(C.COLOR_BLACK);
            g.clear();

            //  title

            xVector v = getMoneyVolumeArray();

            if (v == null || v.size() == 0)
            {
                return;
            }
            int biggest = 0;
            int i       = 0;

            for (i = 0; i < v.size(); i++)
            {
                MoneyVol mv = (MoneyVol)v.elementAt(i);
                if (mv.volume > biggest)
                {
                    biggest = mv.volume;
                }
            }

            float             rx;
            StringBuilder     sb = Utils.sb;
            uint              color;
            int               itemH = (getH() - 18) / v.size() - 4;
            int               y     = 4;
            int               x     = 60;
            stPriceboardState ps    = mContext.mPriceboard.getPriceboard(mShareID);

            if (ps == null)
            {
                return;
            }

            Font   f  = mContext.getFontSmall();
            int    x1 = g.getStringWidth(f, "444.44") + 2;
            int    w0 = getW() - x1;
            string s;

            g.setColor(C.COLOR_GRAY_DARK);
            g.fillRect(0, 0, x1, 14);
            g.setColor(C.COLOR_WHITE);
            g.drawString(f, "Giá", 2, 0);

            g.setColor(C.COLOR_GRAY_DARK);
            g.fillRect(x1 + 2, 0, getW() - x1 - 5, 14);
            g.setColor(C.COLOR_WHITE);
            g.drawString(f, "Khối lượng", x1 + 4, 0);

            y = 18;
            for (i = 0; i < v.size(); i++)
            {
                MoneyVol mv = (MoneyVol)v.elementAt(i);
                sb.Length = 0;
                sb.AppendFormat("{0:F2}", (float)mv.price);
                //  gia
                g.setColor(C.COLOR_GRAY_DARK);
                g.fillRect(0, y, x1, itemH);
                g.setColor(0xffffffff);
                g.drawString(f, sb.ToString(), 2, y);

                if (x1 == 0)
                {
                    x1 = g.getStringWidth(f, sb.ToString());
                }
                //  column
                color = mContext.valToColorF(mv.price, ps.getCe(), ps.getRef(), ps.getFloor());
                g.setColor(color);
                float w = ((float)mv.volume / biggest) * (w0 - 10);
                g.fillRect(2 + x1, y, (int)w, itemH);
                //  volume
                s         = Utils.formatNumber(mv.volume);
                sb.Length = 0;
                sb.AppendFormat("kl={0:}", s);
                s = sb.ToString();
                int w2 = g.getStringWidth(f, s) + 2;
                g.setColor(C.COLOR_GRAY_DARK);
                g.fillRect(4 + x1, y, w2, 14);
                g.setColor(C.COLOR_ORANGE);
                g.drawString(f, s, 5 + x1, y);
                y += itemH + 3;
            }
        }
Example #9
0
        public override void render(xGraphics g)
        {
            if (isFocus())
                g.setColor(0xff306AC5);
            else
                g.setColor(C.COLOR_BLACK);
            g.clear();
            g.setColor(C.COLOR_GRAY_LIGHT);
            g.drawLine(0, 0, getW(), 0);
            g.setColor(C.COLOR_GRAY_LIGHT);
            g.drawLine(0, getH()-2, getW(), getH()-2);
            stPriceboardStateIndex pi = mContext.mPriceboard.getPriceboardIndexOfMarket(mMarketID);
            if (pi == null || pi.current_point == 0)
                return;

            //===========================================
            //  VNIndex 375.3 (-1.86, -0.49%)   KL: 37,716,548 GT: 560.9 ty     up:84 no:53 down:169
            //===========================================
            int x = 0;
            int y = 0;
            uint color;
            /*
            g.setColor(C.COLOR_WHITE);
            g.drawString(mFont, pi.code, x, y);
             */
            int iconIdx = mMarketID == 1 ? 0 : 1;
            g.drawImage(mIcons.Images[iconIdx], 0, 1);

            x = mIcons.ImageSize.Width + 1;

            if (pi.changed_point > 0) color = C.COLOR_GREEN;
            else if (pi.changed_point < 0) color = C.COLOR_RED;
            else color = C.COLOR_YELLOW;
            g.setColor(color);

            String s;
            s = String.Format("{0:F2}", pi.current_point);
            //  point
            g.drawString(mFont, s, x, y);
            x = 77;
            //  change
            String s1 = String.Format("{0:F2}", pi.changed_point);
            float changedPercent = (pi.changed_point * 100) / pi.current_point;
            String s2 = String.Format("{0:F2}", changedPercent);
            StringBuilder sb = Utils.sb;
            sb.Length = 0;
            if (pi.changed_point >= 0)
                sb.AppendFormat("(+{0}, {1})", s1, s2);
            else sb.AppendFormat("(-{0}, {1})", s1, s2);
            s = sb.ToString();
            g.drawString(mFont, s, x, y);
            x = 160;
            //  KL
            g.setColor(C.COLOR_WHITE);
            s = Utils.formatNumber((int)pi.total_volume);
            sb.Length = 0;
            sb.AppendFormat("KL:{0:F1} tr", (double)(pi.total_volume/1000000));
            g.drawString(mFont, sb.ToString(), x, y);

            x = 245;
            //  GT
            sb.Length = 0;
            sb.AppendFormat("GT:{0:F1} tỷ", (double)pi.totalGTGD/1000);
            g.drawString(mFont, sb.ToString(), x, y);
            /*
            x = 520;

            //  up/none/down
            int frmW = mArrows.Width/3;
            int frmH = mArrows.Height;
            g.drawImage(mArrows, x, y, frmW, frmH, 0, 0);
            x += frmW + 2;
            g.setColor(C.COLOR_GREEN);
            g.drawString(mFont, "" + pi.inc_cnt, x, y);
            x += 40;
            //  none
            g.drawImage(mArrows, x, y, frmW, frmH, 2*frmW, 0);
            x += frmW + 2;
            g.setColor(C.COLOR_YELLOW);
            g.drawString(mFont, "" + pi.floor_cnt, x, y);
            x += 40;
            //  down
            g.drawImage(mArrows, x, y, frmW, frmH, frmW, 0);
            x += frmW + 2;
            g.setColor(C.COLOR_RED);
            g.drawString(mFont, "" + pi.dec_cnt, x, y);
             */
        }