diff --git a/changelog.md b/changelog.md index 0efa85bff84331e71960646ed3bc3217a7198da7..591313770ca2be3e7b4fe59ec5b89e4124d690cd 100644 --- a/changelog.md +++ b/changelog.md @@ -23,15 +23,18 @@ v1.1.0 14. Viewport --> public double getMaxYAxisSize(); 15. Viewport --> public double setMaxXAxisSize(double mMaxXAxisViewportSize); 16. Viewport --> public double setMaxYAxisSize(double mMaxYAxisViewportSize); -16. Viewport --> public double setMinimalViewport(double minX,double maxX,double minY,double maxY); -17. StaticLabelsFormatter -- >StaticLabelsFormatter staticLabelsFormatter = new StaticLabelsFormatter(graphView_01,new String[] {"old", "new"},new String[] {"high", "low"}); - (When the static label formatter passes 2 different vertical labels, it displays the first label twice instead of displaying the two collection labels。) - -18. GraphView --> public class GraphView 内takeSnapshotAndShare() -19. LineGraphSeries--> public class LineGraphSeries 内 public void setDrawAsPath() -20. LineGraphSeries -->public class LineGraphSeries 内 public void setAnimated(boolean animated) -21. BarGraphSeries --> public class BarGraphSeries 内 public void setAnimated(boolean animated) -22. Viewport --> public class Viewport 内OverScroller / onScroll -23. LineGraphSeries --> public class LineGraphSeries 内 AccelerateInterpolator -24. 如果2个图形系列具有相同的系列标题,具有不同的系列颜色,则图例中仅显示第一个系列信息 -25. When Y axis labels are huge values or strings, some part of vertical label is crossing vertical axis \ No newline at end of file +17. Viewport --> public double setMinimalViewport(double minX,double maxX,double minY,double maxY); +18. StaticLabelsFormatter -- >StaticLabelsFormatter staticLabelsFormatter = new StaticLabelsFormatter(graphView_01,new String[] {"old", "new"},new + String[] {"high", "low"}); + (When the static label formatter passes 2 different vertical labels, it displays the first label twice instead of displaying the two collection + labels。) +19. GraphView --> public class GraphView 内takeSnapshotAndShare() +20. LineGraphSeries--> public class LineGraphSeries 内 public void setDrawAsPath() +21. LineGraphSeries -->public class LineGraphSeries 内 public void setAnimated(boolean animated) +22. BarGraphSeries --> public class BarGraphSeries 内 public void setAnimated(boolean animated) +23. Viewport --> public class Viewport 内OverScroller / onScroll +24. LineGraphSeries --> public class LineGraphSeries 内 AccelerateInterpolator +25. 如果2个图形系列具有相同的系列标题,具有不同的系列颜色,则图例中仅显示第一个系列信息 +26. When Y axis labels are huge values or strings, some part of vertical label is crossing vertical axis +27. When background color is set for graph using setBackgroundColor() method, little bit of color is crossing horizontal axis +28. setBorderColor and setBorderPaint methods of viewport class are not supported \ No newline at end of file diff --git a/graphveiw/src/main/java/com/jjoe64/graphview/GraphView.java b/graphveiw/src/main/java/com/jjoe64/graphview/GraphView.java index 45d8b1f5d89edc2c790079ad85fcd0d3c5122c61..d28596c93d740f4cfd5b466cb3a2385e6677df60 100644 --- a/graphveiw/src/main/java/com/jjoe64/graphview/GraphView.java +++ b/graphveiw/src/main/java/com/jjoe64/graphview/GraphView.java @@ -38,6 +38,10 @@ import java.util.List; public class GraphView extends Component implements Component.DrawTask, Component.TouchEventListener { public static String TAG = "GraphView : "; + // 表格起始X坐标适配 + private int adaptationStartPoint = 20; + // 表格总宽度的适配 + private int adaptationWidth = 40; @Override public void onDraw(Component component, Canvas canvas) { @@ -405,7 +409,8 @@ public class GraphView extends Component implements Component.DrawTask, Componen */ public int getGraphContentLeft() { int border = getGridLabelRenderer().getStyles().padding; - return border + getGridLabelRenderer().getLabelVerticalWidth() + getGridLabelRenderer().getVerticalAxisTitleWidth() + 20; + return border + getGridLabelRenderer().getLabelVerticalWidth() + + getGridLabelRenderer().getVerticalAxisTitleWidth() + adaptationStartPoint; } /** @@ -444,7 +449,7 @@ public class GraphView extends Component implements Component.DrawTask, Componen graphwidth -= getGridLabelRenderer().getLabelVerticalSecondScaleWidth(); graphwidth -= mSecondScale.getVerticalAxisTitleTextSize(); } - return graphwidth - 40; + return graphwidth - adaptationWidth; } /** diff --git a/graphveiw/src/main/java/com/jjoe64/graphview/GridLabelRenderer.java b/graphveiw/src/main/java/com/jjoe64/graphview/GridLabelRenderer.java index d361f5d67c865014e43d719c2cfabe34f9972d83..95b26506baa1f1121d1a48d50b93a9b00e0a8c81 100644 --- a/graphveiw/src/main/java/com/jjoe64/graphview/GridLabelRenderer.java +++ b/graphveiw/src/main/java/com/jjoe64/graphview/GridLabelRenderer.java @@ -34,6 +34,9 @@ import java.util.Map; */ public class GridLabelRenderer { + private int LABELS_SPACE_MAX = 23; + private int LABELS_SPACE_MIN = 1; + /** * Hoziontal label alignment */ @@ -1928,10 +1931,10 @@ public class GridLabelRenderer { * @param labelsSpace the space between the labels text and the graph content */ public void setLabelsSpace(int labelsSpace) { - if (labelsSpace > 23) { - mStyles.labelsSpace = 23; - } else if (labelsSpace <= 0) { - mStyles.labelsSpace = 1; + if (labelsSpace > LABELS_SPACE_MAX) { + mStyles.labelsSpace = LABELS_SPACE_MAX; + } else if (labelsSpace < LABELS_SPACE_MIN) { + mStyles.labelsSpace = LABELS_SPACE_MIN; } else { mStyles.labelsSpace = labelsSpace; }