Click here to Skip to main content
15,888,579 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Zedgraph is set to GraphPane.YAxis.Scale.MinAuto = true.
The graph is populated with differing data chosen by a combobox.
This obviously results in fluctuating Scale.Min values.
I have a legend located under the min value line. As I select differing sources the location of this legend jumps around.

How can I specify the legends position so that it stays in the same place regardless of input?
It would be easy if the scale was zero'd but as it changes, I'm lost'

What I have tried:

This is the code referencing the text placement.
The value representing UNKNOWN is what I need to determine each time.

TextObj Qtr1Text = new TextObj("Q" + Qtr1 + " 16", dQtrFirst, myPane.YAxis.Scale.Min - UNKNOWN);


or maybe there is a much better way of doing all this?
Posted
Updated 24-Aug-16 14:57pm

1 solution

C#
Finally figured out a reliable way to do this.

    double yOffset = (myPane.YAxis.Scale.Max - myPane.YAxis.Scale.Min) / 36; //magic number
    TextObj Qtr1Text = new TextObj("Text Value", xLocation, yOffset);
    myPane.GraphObjList.Add(Qtr1Text);

The value 36 is an arbitrary number which should be adjusted to give you the negative spacing you want.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900