Profile Picture

Custom Data Label alignment on y-axis

Posted By Brian Dalwood 8 Years Ago
Author
Message
Brian Dalwood
Posted 8 Years Ago
View Quick Profile
Forum Newbie

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
Last Active: 7 Years Ago
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
Posted 8 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)

Group: Forum Members
Last Active: Last Year
Posts: 3,039, Visits: 3,746
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





Similar Topics


Reading This Topic