检测BarSeries线宽忽略的忍者 [英] BarSeries linewidth ignored on Shinobi

查看:229
本文介绍了检测BarSeries线宽忽略的忍者的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图设定忍者BarSeries的条的宽度。
以下code的:

I'm trying to set the width of the bars of a BarSeries with Shinobi. Code's following:

DataAdapter<String, Double> da1 = new SimpleDataAdapter<String, Double>();
        da1.add(new DataPoint<String, Double>("q1", 1.0));
        da1.add(new DataPoint<String, Double>("q2", 3.0));
        da1.add(new DataPoint<String, Double>("q3", 4.5));
        da1.add(new DataPoint<String, Double>("q4", -2.5));
        BarSeries series1 = new BarSeries();
        series1.setDataAdapter(da1);
        BarSeriesStyle css1 = series1.getStyle();
        css1.setLineWidth(180.0f);
        css1.setAreaColor(Color.YELLOW);

        CategoryAxis xAxis = new CategoryAxis();
        chart.setXAxis(xAxis);
        xAxis.getStyle().setInterSeriesPadding(0.2f);
        NumberAxis yAxis = new NumberAxis();
        chart.setYAxis(yAxis);
        yAxis.getStyle().setInterSeriesPadding(0.2f);

        chart.addSeries(series1);

什么情况是,该行 css1.setLineWidth(180.0f); 完全被忽略。我可以把 1.0F 1000.0f 和线总是相同的宽度不管是什么。

What happens is that the line css1.setLineWidth(180.0f); is completely ignored. I can put 1.0f or 1000.0f and the lines are always the same width no matter what.

我在想什么,或者做错了什么?我使用忍者1.5.1。

What am I missing, or doing wrong? I'm using shinobi 1.5.1.

编辑:同样还有的ColumnSeries:

same goes with ColumnSeries:

ColumnSeries cs = new ColumnSeries();
    DataAdapter<Float, Integer> adapterAxis = new SimpleDataAdapter<Float, Integer>();
    adapterAxis.add(new DataPoint<Float, Integer>(0f, 3));
    cs.getStyle().setLineColor(Color.BLACK);
    cs.getStyle().setLineWidth(1f);
    cs.setDataAdapter(adapterAxis);

1F 20F ,没有什么变化。
        chart.addSeries(CS);

1f or 20f, nothing changes. chart.addSeries(cs);

编辑:。以下凯的答案

我试着用 setInterSeriesPadding 玩耍,但它不会做什么,我需要的,如果我接近 1.F 作为填充值栏会缩水,但如果我设置 0F 酒吧将有一个最小高度以及它们之间的空间将保持大。

I tried playing around with setInterSeriesPadding, but it doesn't do what I need in that if I approach 1.f as padding value the bar will shrink, but if I set 0f the bar will have a minimum height and the space between them will remain 'big'.

要更清楚:我有4条在0〜4 Y轴用不同的X值。每一个都集中在Y值或多或少的(不是真的,但不是重要的现在)。例如。在2条中心会从1.8〜来〜2.2和酒吧,3中心会从〜2.8向3.2〜。我希望他们更厚,使他们从去〜1.55〜2.45〜从〜2.55 3.45〜。我该怎么做呢?

To be clearer: I have 4 bars at 0 to 4 on the Y axis with different X values. Each one is centered more or less on the Y value (not really, but not important right now). E.g. bar centered in 2 will go from ~1.8 to ~2.2 and bar centered in 3 will go from ~2.8 to to ~3.2. I want them thicker, so that they go from ~1.55 to ~2.45 and from ~2.55 to ~3.45. How do I do that?

编辑2(图像):

实际

(对不起,我缺乏技能的油漆,它只是表明我希望他们更厚的方式):

Desired (sorry for my lack of Paint skills, it was just a way to show that I want them thicker):

推荐答案

当你指的酒吧一系列的宽度,我会假设你的意思的高度,即从顶部栏的底部测量。我想提的是,setLineWidth()方法不适用于这一目的,但实际上这个方法是用来风格作为边界,围绕棒(或列)的边缘绘制的线条。传递给该方法的值增加时,棒(或列)保持相同的尺寸,但线向内生长。随后,大批会给没有线的外观,酒吧或列将有这么厚,它充满整个酒吧(或列)线。

When you refer to width of a bar series, I am going to assume you mean the height, i.e. measuring from the top to the bottom of the bar. I'd like to mention that the setLineWidth() method is not intended for this purpose, but in fact this method is used to style the line which is drawn around the edge of a bar (or column) to act as a border. As the value passed to this method is increased, the bars (or columns) remain the same size, but the line grows inward. Subsequently, a large number will give the appearance of no line, as the bar or column will have a line so thick that it fills the entire bar (or column).

如果你想操作杆的高度(或列的宽度),你需要使用的方法:

If you wish to manipulate the height of the bars (or the width of the columns) you need to use the methods:

<一个href=\"http://www.shinobicontrols.com/docs/ShinobiControls/ShinobiChartsAndroid/1.5.1/$p$pmium/Normal/apidocs/docs/reference/com/shinobicontrols/charts/AxisStyle.html#setInterSeriesPadding(float)\" rel=\"nofollow\">http://www.shinobicontrols.com/docs/ShinobiControls/ShinobiChartsAndroid/1.5.1/$p$pmium/Normal/apidocs/docs/reference/com/shinobicontrols/charts/AxisStyle.html#setInterSeriesPadding(float)

<一个href=\"http://www.shinobicontrols.com/docs/ShinobiControls/ShinobiChartsAndroid/1.5.1/$p$pmium/Normal/apidocs/docs/reference/com/shinobicontrols/charts/AxisStyle.html#setInterSeriesSetPadding(float)\" rel=\"nofollow\">http://www.shinobicontrols.com/docs/ShinobiControls/ShinobiChartsAndroid/1.5.1/$p$pmium/Normal/apidocs/docs/reference/com/shinobicontrols/charts/AxisStyle.html#setInterSeriesSetPadding(float)

我希望你觉得这个信息有用。感谢和亲切的问候,

I hope that you find this information useful. Thanks and kind regards,

开。

编辑:

您好斯蒂芬,

感谢您的额外信息。

所以,今天我创建了一个快速的应用程序,使用code来填充数据的忍图。

So today I created a quick app, using your code to populate a Shinobi chart with data.

我没有看到你描述薄条的问题。我相信,为了纠正这一点,你还需要调用该方法Axis.setInterSeriesSetPadding(浮点)。

I did see the thin bars issue which you describe. I believe in order to correct this you also need to call the method Axis.setInterSeriesSetPadding(float).

虽然当您在图表中使用单一系列不是很明显,这种方法确实影响个人的酒吧之间的间距。默认情况下有条之间的间距小,如果这个方法不显式调用。

Although when you use a single series in your chart it is not obvious, this method does affect the spacing between individual bars. By default there is a small spacing between bars if this method is not explicitly called.

请也记得这两种方法指望0和1之间的浮点值(没有填充所有)我建议你用0.0的参数调用这两个方法,慢慢地增加值,直到你达到你想要的外观。您应该只需要调用您的类别轴,而不是数据轴这2种方法。

Please remember also that these two methods expect a float value between 0 (no padding at all) and 1. I suggest you call both of these methods with a parameter of 0.0 and slowly increase the values until you achieve the appearance you wish. You should only need to call these 2 methods on your category axis, not the data axis.

虽然建设我应用与您的code我这样做,你用吧系列,但你必须在x轴上的类别轴通知。我发现,当我建我的应用程序它最初只显示3个酒吧,第一类(Q1),被渲染为具有零数据值。这是因为类内部给出的整数索引,因此第一类被存储以0索引。

Whilst building my app with your code I did notice that you use a bar series, but you have your category axis on the x axis. I found when I built my app it initially only displayed 3 bars as the first category ("q1") was rendered as having a zero data value. This is because categories are internally given an integer index, and so the first category is stored with a 0 index.

使用一个棒系列典型的方法是,对x轴的y轴的类别和数据值。我修改我的应用程序使用此配置,我发现所有的4个酒吧正确显示。此外,我能有一个填充,从什么都没有,哪里棒抵靠在对方,来了很多的填充那里的酒吧显得单薄。

The typical way to use a bar series is to have the categories on the y axis and the data values on the x axis. I modified my app to use this configuration and I found all 4 bars showed correctly. Furthermore I was able to have a padding ranging from nothing, where the bars were butted up against each other, to a lot of padding where the bars appear thin.

我希望这会有所帮助,

谢谢,

开。
免责声明:我的工作ShinobiControls

Kai. Disclaimer: I work for ShinobiControls.

这篇关于检测BarSeries线宽忽略的忍者的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆