AChartEngine条形图的跨设备兼容性问题 [英] Cross-Device Compatibility Issue of AChartEngine Bar Graph
问题描述
我能够开发一个条形图丹的帮助下在7平板电脑仿真器,并使其安装在该屏幕我用 setXAxisMax()
和 setXAxisMin()
这是我在该仿真器中获得图:
I am able to develop a Bar Graph with the help of Dan in a 7" tablet emulator and to make it fitted in this screen I used setXAxisMax()
and setXAxisMin()
. Here is the graph I obtained on that emulator:
但是,当我安装了我的手机有不同的屏幕,它是这样的:
But when I installed it my phone with different screen, it looked like this:
纵向
风景
这是我的code:
........................
XYMultipleSeriesRenderer mRenderer = new XYMultipleSeriesRenderer();
mRenderer.setChartTitle("Submission Statistics");
// mRenderer.setXTitle("Verdict Code");
// mRenderer.setYTitle("No. of Submissions");
mRenderer.setAxesColor(Color.BLACK);
mRenderer.setApplyBackgroundColor(true);
mRenderer.setBackgroundColor(Color.WHITE);
mRenderer.setMarginsColor(Color.WHITE);
mRenderer.setZoomEnabled(true);
// mRenderer.setBarSpacing(-0.5);
// mRenderer.setMargins(new int[] {20, 30, 15, 0});
// mRenderer.setShowLegend(false);
mRenderer.setAxisTitleTextSize(16);
mRenderer.setChartTitleTextSize(22);
mRenderer.setLabelsTextSize(15);
mRenderer.setLegendTextSize(15);
// mRenderer.addXTextLabel(1, "AC");
// mRenderer.addXTextLabel(2, "PE");
// mRenderer.addXTextLabel(3, "WA");
// mRenderer.addXTextLabel(4, "TL");
// mRenderer.addXTextLabel(5, "ML");
// mRenderer.addXTextLabel(6, "CE");
// mRenderer.addXTextLabel(7, "RE");
// mRenderer.addXTextLabel(8, "OT");
mRenderer.setBarWidth(80);
mRenderer.setXAxisMin(-6);
mRenderer.setXAxisMax(15);
mRenderer.setYAxisMax(311);
mRenderer.setYAxisMin(0);
mRenderer.setYLabelsAlign(Align.RIGHT);
mRenderer.setXLabelsColor(Color.BLACK);
mRenderer.setLabelsColor(Color.BLACK);
mRenderer.setYLabelsColor(0, Color.BLACK);
mRenderer.setXLabels(0);
mRenderer.setPanEnabled(true, false);
........................
我现在添加 mRenderer.setPanEnabled(真,假);
,这样我可以沿着仅移动X轴看到完整的图。但是,用户应该看到不同设备的屏幕的全图不分。
I add now mRenderer.setPanEnabled(true, false);
so that I can move along only x axis to see the complete chart. But user should see the full chart in screen regardless of different devices.
如何使该柱状图跨装置兼容,以便它不会在左右侧切断
How to make this bar graph cross-device compatible so that it won't cut off on left and right side?
推荐答案
的 setXAxisMin()
和 setXAxisMax()
呼叫设置比例为图形,而不是图的大小
The setXAxisMin()
and setXAxisMax()
calls set the scale for the graph, not the size of the graph.
尝试减少传递到 setBarWidth值()
。我想到的是,图的总宽度是由 num_bars *(X + Y)给出
其中X和Y传递给( setBarWidth(X)
+ setBarSpacing(Y)
)。
Try reducing the value passed to setBarWidth()
. I expect that the total width of the graph is given by num_bars * (X+Y)
where X and Y are passed to (setBarWidth(X)
+ setBarSpacing(Y)
).
我从来没有建有ACE条形图,但我认为应该根据实际窗口宽度和图表在酒吧的数量来计算。希望有所帮助。
I have never built a bar chart with ACE, but I think that should be calculated based on the actual window width and the number of bars in your chart. Hope that helps.
这篇关于AChartEngine条形图的跨设备兼容性问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!