Custom Data Label alignment on y-axis


Author
Message
Brian Dalwood
Brian Dalwood
Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)
Group: Forum Members
Posts: 6, Visits: 15
Hi,
I have a Range Chart that I have configured to show time series data across the x-axis and have applied offsets to the y-axis values to plot data for each machine vertically up the scale.The y-axis scale values are numeric but I am using Custom Labels to replace the numbers with relevant text descriptions.
I cannot get the custom labels to Left Align. The NStringFormatStyle method I am using in the code below doesn’t appear to have any affect.
Can you please let me know how to left align the custom axis labels?

https://www.nevron.com/forum/uploads/images/6ed4e43c-6233-44b4-89bc-479b.jpg

            NChart chart = context.document.Charts[0];
            NRangeSeries range = chart.Series[0] as NRangeSeries;
           
            // add custom label to the Y axis
                  NAxis yAxis = chart.Axis(StandardAxis.PrimaryY);

                  for (int i=1; i < range.Values.Count; i++)
                  {
                        string machineName = (string)range.Labels[i];
                       
                        NCustomValueLabel valueLabel = new NCustomValueLabel(i, machineName);
                       if (valueLabel.Text == "Filler")
                       {
                              valueLabel.Style.TextStyle.FillStyle = new NColorFillStyle(Color.Red);
                              valueLabel.Style.TextStyle.BackplaneStyle.Visible = true;
                              valueLabel.Style.TextStyle.BackplaneStyle.FillStyle = new NColorFillStyle(Color.Yellow);
                              valueLabel.Style.TextStyle.BackplaneStyle.StandardFrameStyle.Visible = false;                        
                       }
                       valueLabel.Style.TextStyle.FontStyle.Name = "Tahoma";
                       valueLabel.Style.TextStyle.StringFormatStyle = new NStringFormatStyle(StringFormatType.GenericDefault, HorzAlign.Left, VertAlign.Center);
                       yAxis.ScaleConfigurator.CustomLabels.Add(valueLabel);
                  }



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.2K
You need to modify the label content alignment:
valueLabel.Style.ContentAlignment = ContentAlignment.BottomCenter;

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
1 active, 1 guest, 0 members, 0 anonymous
No members currently viewing this topic!

Login

Explore
Messages
Mentions
Search