Giter Site home page Giter Site logo

时间轴挤在一起了 about klinechart HOT 4 OPEN

fujianlian avatar fujianlian commented on August 29, 2024
时间轴挤在一起了

from klinechart.

Comments (4)

HowKeung avatar HowKeung commented on August 29, 2024 2

列数已经比较少的情况下,比如5列,第一个和最后一个时间仍然会和挨着的时间重叠,可以修改显示的第一个时间和最后一个时间的位置,在BaseKLineChartView.java文件中drawText方法,
418行-422行是显示第一个时间,修改前

float translateX = xToTranslateX(0);
        if (translateX >= startX && translateX <= stopX) {
            canvas.drawText(getAdapter().getDate(mStartIndex), 0, y, mTextPaint);
        }

修改后

float translateX = xToTranslateX(0);
        if (translateX >= startX && translateX <= stopX) {
            String text = getAdapter().getDate(mStartIndex);
            canvas.drawText(text, 0 - mTextPaint.measureText(text) / 2, y, mTextPaint);
        }

418行-427行是显示最后一个时间
修改前

translateX = xToTranslateX(mWidth);
        if (translateX >= startX && translateX <= stopX) {
            String text = getAdapter().getDate(mStopIndex);
            canvas.drawText(text, mWidth - mTextPaint.measureText(text), y, mTextPaint);
        }

修改后

translateX = xToTranslateX(mWidth);
        if (translateX >= startX && translateX <= stopX) {
            String text = getAdapter().getDate(mStopIndex);
            canvas.drawText(text, mWidth - mTextPaint.measureText(text) / 2, y, mTextPaint);
        }

这样第一个时间和最后一个时间都只显示一半

from klinechart.

fujianlian avatar fujianlian commented on August 29, 2024 1

可以通过调整列数或者时间轴数据显示

from klinechart.

alun1 avatar alun1 commented on August 29, 2024

大佬能指教一下吗

from klinechart.

alun1 avatar alun1 commented on August 29, 2024

好的谢谢,还有一个问题就是,好像很多情况显示不出来MACD,比如30分钟,60分钟,日K 的数据就不行,而周K,月K是可以显示的

from klinechart.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.