|
Dotted/Dsahed borders bars |
Posted by djschorn on May-06-2015 17:08 |
|
Hi,
Is there a way to have a BarLayer with dashed borders ? I did not find something in the documentation or an exemple.
Thanks by advance |
Re: Dotted/Dsahed borders bars |
Posted by Peter Kwan on May-07-2015 00:58 |
|
Hi djschorn,
Any line in ChartDirector can be a dash line by using a "dash line color" as the color. For
example:
//Set bar border to a black (0x000000) dash line color
myBarLayer.setBorderColor(c.dashLineColor(0x000000));
Hope this can help.
Regards
Peter Kwan |
Re: Dotted/Dsahed borders bars |
Posted by djschorn on May-07-2015 21:37 |
|
Thanks for your reply.
In your exemple, the border style is defined on the Layer level.
But I need to have several data set in the same layer (for Chart.Stack, Chart.Overlay, ....),
is it possible to set this border style on the data set level and have several border styles in the same layer ?
Like addDataSet().setBorder() or something like that.
Thanks |
Re: Dotted/Dsahed borders bars |
Posted by Peter Kwan on May-08-2015 01:38 |
|
Hi djschorn,
There is an API DataSet.setDataColor that allows you to set different border colors for
different data sets. For example:
ChartDirector.DataSet d = layer.adDDataSet(........);
d.setDataColor(fillColor, borderColor);
You can use a dashLineColor as the borderColor to make a dash line border for that data
set.
Note that two adjacent bar segments may share a border. In this case, the shared border
will be painted by the two bar segments. The second bar segment may overwrite the border
of the first one, or the colors may mix together if they are semi-transparent.
Hope this can help.
Regards
Peter Kwan |
Re: Dotted/Dsahed borders bars |
Posted by djschorn on May-11-2015 17:30 |
|
Perfect, it works ! |
Re: Dotted/Dsahed borders bars |
Posted by djschorn on May-19-2015 03:38 |
|
After rendering my chart (see attached image), I understood your remarks :
"Note that two adjacent bar segments may share a border. In this case, the shared border
will be painted by the two bar segments. The second bar segment may overwrite the border of the first one, or the colors may mix together if they are semi-transparent."
If I understand correctly, there is no solution to have a dashed line on the shared border (2012/2013) ?
Thanks again
|
Re: Dotted/Dsahed borders bars |
Posted by Peter Kwan on May-20-2015 00:32 |
|
Hi djschorn,
As mentioned above, the border between the bars are drawn twice, one by each bar. If
they are dashed lines, it is possible for the two dashed lines to merge to become a solid
line. To reliably achieve the effect you want, the only method is configure the bars to not
having any border at all, then custom draw the vertical and horizontal lines (using
BaseChart.addLine) to achieve the effect you want. As this involves quite some code, you
may consider to use other methods to distinguish the bars instead of using dashed lines. For
example, you can use solid lines of other colors, or use a different color or patterns to fill
the bars.
Regards
Peter Kwan |
Re: Dotted/Dsahed borders bars |
Posted by djschorn on May-26-2015 22:16 |
|
Indeed the solution to draw some lines for each bars would be a little complicated.
Thanks for your help. |
|