[CLOSED] CartesianChart Background Color

  1. #1

    [CLOSED] CartesianChart Background Color

    How do I change the background color of just the graph in a CartesianChart object? Setting the Chart.Background color changes the color of the entire chart (including, for instance, the color behind the axis labels). I'm interested in changing the background color only in the space where the gridlines appear. Here is a picture showing what I would like; notice that the beige only appears behind the graph area, and isn't showing up behind the axis labels:

    Click image for larger version. 

Name:	CAPTURE3.png 
Views:	56 
Size:	4.6 KB 
ID:	24047

    Thanks!
    Last edited by Dimitris; Jul 01, 2015 at 3:17 PM. Reason: [CLOSED]
  2. #2
    Hello @MrProtonYo!

    We are most sure that yes, that's possible.

    Have you tried building a chart with dummy data (a test case)? If so, can you provide the code for the test case you're writing so we can provide you feedback about how to achieve that goal?

    If looking for a starting point I can suggest you to start copypasting the code for this example.

    Probably your solution will be, inside the axis definition (<Axes>), add a <GridConfig> to your axis setting the FillStyle to the desired color...
    Something in these lines:
    <Axes>
     <ext:NumericAxis>
      <GridConfig>
       <Even FillStyle="orange" />
       <Odd FillStyle="orange" />
      </GridConfig>
     </ext:NumericAxis>
    </Axes>
    Try to use this tip while reviewing or building your test case. If it does not help, let us know and provide your test case with how far you went with it, and we can further investigate it.
    Fabrício Murta
    Developer & Support Expert
  3. #3

    Fixed

    Your solution worked. It actually was even easier than you suggested, since I didn't need to deal with odd or even stuff. All I had to do was take my numeric axis and add an object to its GridConfig property.

            let numericAxis = new NumericAxis()
            numericAxis.Fields <- [||]
            numericAxis.Position <- Position.Left
            numericAxis.Grid <- true
            let axisGrid = new AxisGrid()
            axisGrid.Fill <- "#E9E2C9"
            numericAxis.GridConfig <- axisGrid
            numericAxis.Title <- barChartData.Value.Title
            chart.Axes.Add(numericAxis)
  4. #4
    Great! Thats awesome that you shared with us the actual solution for your issue, that'll come handy when other people needs it. Thank you very much!
    Fabrício Murta
    Developer & Support Expert

Similar Threads

  1. [CLOSED] Change Color Window's Header Background Color
    By rguardado in forum 3.x Legacy Premium Help
    Replies: 3
    Last Post: Jan 16, 2015, 3:48 PM
  2. [CLOSED] Change TreePanel background color and toolbar color
    By jchau in forum 2.x Legacy Premium Help
    Replies: 5
    Last Post: Dec 07, 2012, 4:42 PM
  3. panel background color
    By unaltro2 in forum 1.x Help
    Replies: 2
    Last Post: Jan 10, 2011, 2:30 PM
  4. Background color in codebehind
    By fabiomarcos in forum 1.x Help
    Replies: 8
    Last Post: Oct 30, 2010, 3:58 PM
  5. Change Tab background color or background image
    By georgelanes in forum 1.x Help
    Replies: 0
    Last Post: Nov 06, 2008, 3:55 PM

Posting Permissions