Jump to content
JChartFX Community
  • 0

Setting the color and alignment of a custom grid line


bhawk90

Question

Hi,

I'm trying to set the color of a custom grid line to something besides the default red color, but it doesn't work. It just stays red. Has anyone else had this problem?

Also, I can't seem to set the alignment of the label of a custom grid line. I get an error, and the documentation says I should see the .NET documentation...isn't this all supposed to be in JavaScript?

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

jChartFX has 2 "modes" of work. If you include jchartfx.css we will pick up most (if not all) the colors from this file. In the case of a custom grid line we will generate an object that looks like this

 class="CustomGridLine AxisY_CustomGridLine AxisY0_CustomGridLine0"

Which means you can set the color for all custom grid lines, for all the custom gridlines in the Y axis or for a specific custom grid line by editing the CSS. e.g.

.jchartfx .CustomGridLine {
 stroke: #00F035;
}

.jchartfx .CustomGridLineLabel {
 fill: #660066;
}
 

If you DO NOT include jChartFX.css you can control the colors using our API (I am guessing this is what you are trying already but because you are including the CSS it takes priority over the API calls)

To control the label alignment in a CustomGridLine you should use setAlignment and/or setLineAlignment as follows

customGridLine.setAlignment(cfx.StringAlignment.Center);

The other possible alignments are Near and Far. About the documentation, our control was first developed as a .NET control so I am afraid some of the documentation has not been properly changed. The current build also has an issue aligning text to the top so LineAlignment.Far will not work as expected, we should be fixing this in a future build.

Regards,

JuanC

Link to comment
Share on other sites

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.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...