|
Positive Negative Bars "style" |
Posted by djschorn on Mar-12-2015 00:55 |
|
Hello,
Is there a way to do a "Positive Negative Bars" chart but where the value for comparison is not 0 but 100 for exemple ?
I try to explain with an exemple in attachment.
Thanks by advance
|
Re: Positive Negative Bars "style" |
Posted by Peter Kwan on Mar-13-2015 02:41 |
|
Hi djschorn,
Yes. You can set the "baseline" to any value. I have attached an example I modified from
the original "Positive Negative Bars" to allow for configurable baseline.
Hope this can help.
Regards
Peter Kwan
|
Re: Positive Negative Bars "style" |
Posted by djschorn on Mar-13-2015 17:04 |
|
It's seems to works.
Thanks. |
Re: Positive Negative Bars "style" |
Posted by djschorn on Mar-19-2015 00:35 |
|
Another question.
I have not found how to change the color of this baseline.
Is there a way to do that ?
Thanks |
Re: Positive Negative Bars "style" |
Posted by djschorn on Mar-19-2015 00:36 |
|
Another question.
I have not found how to change the color and the thickness of this baseline.
Is there a way to do that ?
Thanks |
Re: Positive Negative Bars "style" |
Posted by Peter Kwan on Mar-20-2015 01:51 |
|
Hi djschorn,
The "baseline" is just the position to start drawing the bar. It is not actually a visible line. If
you need a visible line, you may add a "mark line" at the baseline position. For example:
Mark m = c.yAxis().addMark(baseLinePos, 0x000000);
m.setLineWidth(2);
Hope this can help.
Regards
Peter Kwan |
Re: Positive Negative Bars "style" |
Posted by djschorn on Mar-24-2015 18:59 |
|
Indeed it works.
Just a remarks, in the documentation the attribute definition of value
public Mark addMark(double value, int lineColor [, String text [, String font [, double fontSize ]]]) where value is : The value on the axis to draw the mark line.
But value is % (relative) on the axis (in my exemple 50).
It would have been nice if we could put an "absolute" value (in my exemple 100).
If there is a solution ....
Thanks |
Re: Positive Negative Bars "style" |
Posted by Peter Kwan on Mar-25-2015 00:19 |
|
Hi djschorn,
Sorry, I probably do not understand your question. Would you mind what does it mean to be
the value is "relative" on the axis, or what is the "absolute" value means? May be you can
attached a chart image to help me understand your requirement.
In brief, if you use c.yAxis().addMark(100, ...), it will add the mark the at position 100 of
the yAxis().
If you want to add a line at the pixel coordinate 100, you may use BaseChart.addLine
instead of Axis.addMark.
Regards
Peter Kwan |
Re: Positive Negative Bars "style" |
Posted by djschorn on Mar-25-2015 17:24 |
|
Peharps my explanations are not very clear.
In attachment some exemples with 3 values (10, 50 and 100)
The line is draw in yellow.
As said before, it seems that value is a %. But not a absolute value.
Thanks again.
|
Re: Positive Negative Bars "style" |
Posted by Peter Kwan on Mar-26-2015 00:23 |
|
Hi djschorn,
Is it possible your mark is associated with the wrong y-axis (the unused left y-axis, rather
than the right y-axis)? In ChartDirector, if an axis is not used, it will have a default scale of
0 to 100, so a mark attached to that axis will have the behaviour you see.
As I do not have your code, I am not sure if you are using yAxis or yAxis2. In ChartDirector,
by default, the right y-axis is yAxis2, but you can change it to yAxis by using
setYAxisOnRight. In our "Positive Negative Bar" sample code, we do use setYAxisOnRight, so
the right y-axis is yAxis instead of yAxis2. So in our sample code, the mark should be added
to yAxis, like:
c.yAxis().addMark(100, 0xff0000);
I have attached the modified sample code which the addMark line for your referernce. It
works normally in my computer.
For your case, if your right y-axis is yAxis2 instead, please use:
c.yAxis2().addMark(100, 0xff0000);
If the above still does not solve the problem, is it possible to provide a hard coded example
(such as by modifying the attached sample code) to help us reproduce the problem?
Regards
Peter Kwan
|
Re: Positive Negative Bars "style" |
Posted by djschorn on Mar-27-2015 23:02 |
|
What a shame, You're right !
I put the marker on the yAxis and not on the yAxis2.
Thanks |
|