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


Author
Message
Andrew Soper
Andrew Soper
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
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
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.1K
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
Andrew Soper
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
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
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.1K
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


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic
2 active, 2 guests, 0 members, 0 anonymous
No members currently viewing this topic!

Login

Explore
Messages
Mentions
Search