Profile Picture

How do I move the Position of Custom Value Field Using C#

Posted By Andrew Soper 9 Years Ago

How do I move the Position of Custom Value Field Using C#

Author
Message
Andrew Soper
Posted 9 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)

Group: Forum Members
Last Active: 9 Years Ago
Posts: 4, Visits: 8
Hello,

I am new to C# and was wondering how I can move the x and y position of the Value Field so it is easier to read.  I appreciate any help.  Below is my code:

using System;

using System.Drawing;

using Nevron.GraphicsCore;

using Nevron.Chart;

using Nevron.ReportingServices;

namespace MyNamespace

{

    /// <summary>

    /// Sample class

    /// </summary>

    public class MyClass

    {

        /// <summary>

        /// Main entry point

        /// </summary>

        /// <param name="context"></param>

        public static void RSMain(NRSGaugeCodeContext context)

        {

            // check if gauge document contains gauges

            if (context.document.Gauges.Count == 0)

                return;

             double target = context.GetDoubleParameter("Target");

            // get the first gauge

            NGaugePanel gauge = context.document.Gauges[0] as NGaugePanel;

            if (gauge.Indicators.Count == 0)

                return;

            // adding custom range labels

            NLinearScaleConfigurator scale = ((NGaugeAxis)gauge.Axes[0]).ScaleConfigurator as NLinearScaleConfigurator;

            NCustomValueLabel customValueLabel = new NCustomValueLabel(target, "Target - "+ target);

            customValueLabel.Style.KeepInsideRuler = false;

            customValueLabel.Style.TextStyle.FillStyle = new NColorFillStyle(Color.Black);

            customValueLabel.Style.Angle = new NScaleLabelAngle(ScaleLabelAngleMode.Scale, 0);

            scale.CustomLabels.Add(customValueLabel);

        }

    }

}

Thanks!


Nevron Support
Posted 9 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Yesterday @ 1:38 AM
Posts: 3,054, Visits: 4,006
Hi Andrew,
Please elaborate - what do you mean by "move the x and y position of the Value Field " - is this the value of an indicator or something else?


Best Regards,
Nevron Support Team



Andrew Soper
Posted 9 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)

Group: Forum Members
Last Active: 9 Years Ago
Posts: 4, Visits: 8
No problem.  By moving the X and Y, I mean how to move the position that the Value label is displayed within the SharePoint Gauge.

Thanks!

Andrew

Nevron Support
This post has been flagged as an answer
Posted 9 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Yesterday @ 1:38 AM
Posts: 3,054, Visits: 4,006
Hi Andrew,

You cannot freely move a custom axis value label - it is anchored to a specified value on the scale. You can only change the way the custom axis value label is aligned relative to its origin point using the ContentAlignment property - for example:

customValueLabel.Style.ContentAlignment = ContentAlignment.BottomLeft;

If you want to create labels that you can freely move around the gauge control you can use a label panel for this purpose:

   NLabel labelPanel = new NLabel();

   double value = 10;
   labelPanel.Text = "Target" + value.ToString();

   labelPanel.Location = new NPointL(new NLength(10, NGraphicsUnit.Pixel), new NLength(10, NGraphicsUnit.Pixel));

   nChartControl1.Panels.Add(labelPanel);
The above code displays a label at [10, 10] pixels from the left top corner. Hope this helps - let us know if you meet any problems or have any questions.





Best Regards,
Nevron Support Team





Similar Topics


Reading This Topic