Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Y axes label format

Hello,

 

Is there a way to have the format  '10^0' instead of 'E0' on the Y axes.

 (10^1, 10^2,10^3  instead of E+001, E+002, E+003)

 

Thanks

0 Kudos
Message 1 of 5
(4,040 Views)

Hi Virgule,

 

Are you creating graphs using Windows Forms or Windows Presentation Foundation?

 

 

Regards,
0 Kudos
Message 2 of 5
(3,960 Views)

On Windows forms.

 

Thanks,

0 Kudos
Message 3 of 5
(3,892 Views)

Hi Virgule,

 

I was able to use the following code to map the y axis as you requested. I did have to change the y-axis scaling for the graph to logarithmic to prevent labels on the low end from overlapping each other.

 

 

//Data to plot to the graph
double[] actualData = new double[] { 1, 200, 600, 800, 1000, 2, 4, 20, 100, 1000000000 };

 

//In this case, this is really the number of y-axis labels you want to map
int numberOfSamples = 10;

 

 

//Customized Y Axis


//Labels for Y axis
string[] labelData = new string[] { "10^0", "10^1", "10^2", "10^3", "10^4", "10^5", "10^6", "10^7", "10^8", "10^9" };


//Values to Map labels to
double[] indexData = new double[] { 0, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000};


//Hide default axis elements
yAxis1.MajorDivisions.GridVisible = false;
yAxis1.MajorDivisions.TickVisible = false;
yAxis1.MajorDivisions.LabelVisible = false;

 

//Loop which generates Y axis labels
for (int i = 0; i < numberOfSamples; i++)
{
   // Use AxisCustomDivision to map indices to labels
   yAxis1.CustomDivisions.Add(new AxisCustomDivision(indexData[i], labelData[i]));
}

 

//Plot actualData to plot
waveformGraph1.PlotY(actualData);

 

 

 

 

 

 

 

 

Regards,
0 Kudos
Message 4 of 5
(3,881 Views)

Thanks for this help. i will try to implement a function by using your solution.

 

I hope, in the future, that NI will add this new label format in the scattergraph.

 

Regards

0 Kudos
Message 5 of 5
(3,867 Views)