Coder Social home page Coder Social logo

Comments (4)

lecho avatar lecho commented on July 22, 2024 1

Hi,

  • first option, change viewport of the chart, for example:
//set chart data to initialize viewport, otherwise it will be[0,0;0,0]
//get initialized viewport and change if ranges according to your needs.
final Viewport v = new Viewport(chart.getMaximumViewport());
float fivePercent = v.height() * 0.05f;
v.top = v.top + fivePercent;
v.bottom = v.bottom - fivePercent; 
chart.setMaximumViewport(v);
chart.setCurrentViewport(v);
//Optional step: disable viewport recalculations, thanks to this animations will not change viewport automatically.
//chart.setViewportCalculationEnabled(false);
  • Second option, disable/change clipping, there is no method for that, you will need to modify source code. You can remove line AbstractChartView.java#L89 or replace it with the following line:
canvas.clipRect(chartComputator.getContentRectMinusAxesMargins());

Btw. labels for Y axis overlap axis name, you can set maximum numbers of chars for label to avoid that:

Axis.setMaxLabelChars(5)

from hellocharts-android.

eralpkaraduman avatar eralpkaraduman commented on July 22, 2024

screenshot

I kind of duct taped it by adding another line with 2 values, +0.10 of max of original line, and -0.10 of min of original line. I set it a transparent colour and voila I got nice margins :)

Please suggest me any way to fix it, I don't wan't to keep it this way.

from hellocharts-android.

eralpkaraduman avatar eralpkaraduman commented on July 22, 2024

Thanks!

from hellocharts-android.

aychan avatar aychan commented on July 22, 2024

@eralpkaraduman , did @lecho 's first option work for you? I have a similar issue regarding the max y axis label not showing up and the cubic function being clipped.

Thanks in advance!
EDIT: looking at src:
@lecho was so right by doing such:

final Viewport v = new Viewport(chart.getMaximumViewport());
//set the .top .bottom .right
chart.setMaximumViewport(v);
chart.setCurrentViewport(v);

and also make sure to do such as well:
chart.setViewportCalculationEnabled(false);
They did the trick for me - thanks so much!

from hellocharts-android.

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.