Question

I need to apply color to teechart axis using System.drawing.Color Object

Code is

//chartData.ChartAxesArray[iAxis].AxisTitleColor is System.drawing.Color Object

//objAxis.Title.Brush.Color is ChartFont.Color

  objAxis.Title.Brush.Color = chartData.ChartAxesArray[iAxis].AxisTitleColor;

This code not work as per expectation for color which are not named one or known one

Was it helpful?

Solution

Being tChart1 an Steema.TeeChart.TChart object, with some series and values on it, you should be able to change the axis font color as I do here with the bottom axis:

        tChart1.Axes.Bottom.Labels.Font.Color = Color.Green;

However, I'm not sure if you are trying to set a brush color to the labels. Then, note the labels rectangle is transparent by default, so you should do something as below:

        tChart1.Axes.Bottom.Labels.Transparent = false;
        tChart1.Axes.Bottom.Labels.Brush.Color = Color.Yellow;

OTHER TIPS

Try this:

chartData.ChartAxesArray[iAxis].AxisTitleColor =
                               System.Drawing.ColorTranslator.FromHtml("#00FF80");

// 00FF80 = R=0 G=255 B=128

See that you have objAxis.Title.Brush.Color in the code you provided above. Shouldn't it be: objAxis.Title.Font.Color ?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top