fxinq1009 Posted January 11, 2010 Report Share Posted January 11, 2010 I have a Bar chart with Y values ranging from positive to negative using style MATH for Axis display. Client wants to add an additional horizontal black line at value 0 where all the bars base on. Does anybody know how to do that? Thanks. Quote Link to comment Share on other sites More sharing options...
CarlosAC Posted January 13, 2010 Report Share Posted January 13, 2010 Hi fxinq1009 You can use a CustomGridLine, please check the following code: CustomGridLine cgl = new CustomGridLine(); cgl.Value = 0; cgl.Color = Color.Black; chart1.AxisY.CustomGridLines.Add(cgl); -- Pipon Quote Link to comment Share on other sites More sharing options...
fxinq1009 Posted January 15, 2010 Author Report Share Posted January 15, 2010 Hi Pipon, Thank you very much for the information. Do you know which version of Chart FX has the CustomGridLine class? I'm using version 6, it seems the class does not exist. -- fxinq1009 Quote Link to comment Share on other sites More sharing options...
CarlosAC Posted January 15, 2010 Report Share Posted January 15, 2010 Hi fxinq1009 I apologize since I copied code valid for Chart FX 7 and not for Chart FX 6.x for Java. Unfortunately, Chart FX 6.x for Java does not have the Custom Grid Lines option. From checking the API, I found a possible workaround. Please check following code: AxisSection section1 = chart1.getAxisX().getSections().getItem(0);section1.setFrom(0);section1.setTo(0);section1.setFontStyle(java.awt.Font.BOLD|java.awt.Font.ITALIC);section1.setGridlines(true);section1.setTextColor(java.awt.Color.red);section1.setBackColor(new java.awt.Color(255,0,0,32));section1.getGrid().setColor(section1.getTextColor());section1.getGrid().setWidth(2); Please note that I am setting FROM and TO values with Quote Link to comment Share on other sites More sharing options...
fxinq1009 Posted January 15, 2010 Author Report Share Posted January 15, 2010 Hi Pipon, Thanks for the quick response. It looks like what you provided will work. I'll give a try. -- Leon Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.