Page 1 of 1

Drawing labels and ticks on the axis in case of series lack

Posted: Wed Feb 26, 2014 9:13 am
by 15666633
Hello, is it possible to show ticks and labels on the axis when seriries associated with the axis are invisible, or are absent. Generaly, i want one custom axis for one line, and i want to have ability to hide this line, without hiding axis, but when i do it, all the labels and dick disappearars. what should i do to fix this disappearing?

Re: Drawing labels and ticks on the axis in case of series lack

Posted: Wed Feb 26, 2014 2:39 pm
by Christopher
Petr wrote:Hello, is it possible to show ticks and labels on the axis when seriries associated with the axis are invisible, or are absent. Generaly, i want one custom axis for one line, and i want to have ability to hide this line, without hiding axis, but when i do it, all the labels and dick disappearars. what should i do to fix this disappearing?
You could use the Series.Transparency property, e.g.

Code: Select all

    private void InitializeChart()
    {
      tChart1.Series.Add(typeof(Bar)).FillSampleValues();    
    }

    private void button1_Click(object sender, EventArgs e)
    {
      //tChart1[0].Visible = !tChart1[0].Visible;
      tChart1[0].Transparency = tChart1[0].Transparency == 0 ? 100 : 0;
    }

Re: Drawing labels and ticks on the axis in case of series lack

Posted: Thu Feb 27, 2014 7:07 am
by 15666633
Hi Christopher, unfrtunately that doesn't helps. let me try to explain you on example.In attachement there are two pics, on the "active axis.png" you can see the situation than all axes are active( active means that line is visible ). In this case axis has the same color as line and have labels and marks on it ( so, it's scaled ). On the second pic, called "inactive axis.png" you can see the situation i want to modify, the first plot is invisible now( you can see it's uncheked ), so the first axis is inactive, that means that should become gray with saving all the marks and labels on it. As you can see it's gray, but, there are no labels and ticks on it. So what should i do to set it back?

Re: Drawing labels and ticks on the axis in case of series lack

Posted: Thu Feb 27, 2014 8:56 am
by Christopher
Petr wrote:Hi Christopher, unfrtunately that doesn't helps. let me try to explain you on example.In attachement there are two pics, on the "active axis.png" you can see the situation than all axes are active( active means that line is visible ). In this case axis has the same color as line and have labels and marks on it ( so, it's scaled ). On the second pic, called "inactive axis.png" you can see the situation i want to modify, the first plot is invisible now( you can see it's uncheked ), so the first axis is inactive, that means that should become gray with saving all the marks and labels on it. As you can see it's gray, but, there are no labels and ticks on it. So what should i do to set it back?
I think I understand your situation. What I don't understand is why you cannot set the Series.Transparency property to 100 instead of setting the Series.Active/Visible property to false when you uncheck the checkbox. The issue is here that axis labels and ticks will only be drawn if a series is associated to the axis, and setting the Series.Active/Visible property to false disassociates the series from the axis. The only way, therefore, to have the series invisible but the axis labels and ticks visible is to keep the series associated to the axis, that is, keep the Series.Active/Visible property set to true, but to set the Series.Transparency to 100.

Re: Drawing labels and ticks on the axis in case of series lack

Posted: Thu Feb 27, 2014 10:43 am
by 15666633
Thanks a lot, setting transparency to series solved this problem.