Bar Chart label problems

Thread is closed for posting
4 posts, 0 answers
  1. Scott
    Scott avatar
    7 posts
    Member since:
    Feb 2011

    Posted 16 May 2012 Link to this post

    Having problems with labels showing up in the right place or at all. I have multiple charts on one page and one chart has 4 series in it and I am using this code to set the lables positions but some of them dont show up at all.

    Series2_3.Items[0].Label.Appearance.LabelLocation = Telerik.Charting.Styles.

     

    StyleSeriesItemLabel.ItemLabelLocation.Outside;

     

    Series2_3.Items[0].Label.Appearance.Position.AlignedPosition = Telerik.Charting.Styles.

     

    AlignedPositions.Left;

    also I am setting the label text  color to black but that doesn't work either

     

    Series2_1.AddItem(itm2.AdministrativeServices,

     

    "Administrative Services", Color.Black);


    any suggestions?
    Thanks!

     

  2. Scott
    Scott avatar
    7 posts
    Member since:
    Feb 2011

    Posted 16 May 2012 Link to this post

    Here is a picture of the part of the chart that I am having trouble with
     and the code that generates the bugs in the chart.

    Series2_1.AddItem(itm2.AdministrativeServices, "Administrative Services", Color.Black);
               Series2_1.Items[0].Appearance.FillStyle.MainColor = Color.FromArgb(250, 245, 84, 117);
               Series2_1.Items[0].Appearance.FillStyle.SecondColor = Color.FromArgb(250, 245, 84, 117);
               Series2_1.Items[0].ActiveRegion.Url = "DashboardDetails.aspx?c=AS";
               Series2_1.Items[0].ActiveRegion.Tooltip = "Administrative Services";
               Series2_1.Items[0].Label.Appearance.Visible = true;
               Series2_1.Items[0].Appearance.Border.Color = Color.Transparent;
               Series2_2.AddItem(itm2.AdministrativeServicesToConcept, "To Concept");
               Series2_2.Items[0].Appearance.FillStyle.MainColor = Color.FromArgb(150, 245, 84, 117);
               Series2_2.Items[0].Appearance.FillStyle.SecondColor = Color.FromArgb(150, 245, 84, 117);
               Series2_2.Items[0].Appearance.Border.Color = Color.Transparent;
               Series2_2.Items[0].Label.Appearance.LabelLocation = Telerik.Charting.Styles.StyleSeriesItemLabel.ItemLabelLocation.Outside;
               Series2_2.Items[0].Label.Appearance.Position.AlignedPosition = Telerik.Charting.Styles.AlignedPositions.Left;
               Series2_3.AddItem(itm2.AdministrativeServicesApproved, "Approved");
               Series2_3.Items[0].Appearance.FillStyle.MainColor = Color.FromArgb(50, 245, 84, 117);
               Series2_3.Items[0].Appearance.FillStyle.SecondColor = Color.FromArgb(50, 245, 84, 117);
               Series2_3.Items[0].Appearance.Border.Color = Color.Transparent;
               Series2_3.Items[0].Label.Appearance.LabelLocation = Telerik.Charting.Styles.StyleSeriesItemLabel.ItemLabelLocation.Outside;
               Series2_3.Items[0].Label.Appearance.Position.AlignedPosition = Telerik.Charting.Styles.AlignedPositions.Left;
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Scott
    Scott avatar
    7 posts
    Member since:
    Feb 2011

    Posted 17 May 2012 Link to this post

    I included an image of the whole chart. You can see that the labels work fine on some bars but on the first bars
    they dont show up at all? Here is all the code. Seems like it should be a simple thing I am overlooking.
    So your help is greatly appreciated!


    RadChart2.ChartTitle.TextBlock.Text = "Services";
                BL.Containers.Ideas itm2 =  BL.Containers.Ideas .GetCount();
      
                Telerik.Charting.ChartSeries Series2_1 = new Telerik.Charting.ChartSeries();
                Telerik.Charting.ChartSeries Series2_2 = new Telerik.Charting.ChartSeries();
                Telerik.Charting.ChartSeries Series2_3 = new Telerik.Charting.ChartSeries();
                Telerik.Charting.ChartSeries Series2_4 = new Telerik.Charting.ChartSeries("Denied");
      
                RadChart2.AddChartSeries(Series2_1);
                RadChart2.AddChartSeries(Series2_2);
                RadChart2.AddChartSeries(Series2_3);
                RadChart2.AddChartSeries(Series2_4);
      
                Series2_1.AddItem(itm2.AdministrativeServices, "Administrative Services", Color.Black);
                Series2_1.Items[0].Appearance.FillStyle.MainColor = Color.FromArgb(250, 245, 84, 117);
                Series2_1.Items[0].Appearance.FillStyle.SecondColor = Color.FromArgb(250, 245, 84, 117);
                Series2_1.Items[0].Label.Appearance.LabelLocation = Telerik.Charting.Styles.StyleSeriesItemLabel.ItemLabelLocation.Outside;
                Series2_1.Items[0].Label.Appearance.Position.AlignedPosition = Telerik.Charting.Styles.AlignedPositions.Left;
                Series2_1.Items[0].Label.TextBlock.Text = "WTF?";
                Series2_1.SetItemLabel(0,"WTF");
                Series2_1.Items[0].ActiveRegion.Url = "DashboardDetails.aspx?c=AS";
                Series2_1.Items[0].ActiveRegion.Tooltip = "Administrative Services";
                Series2_1.Items[0].Label.Appearance.LabelLocation = Telerik.Charting.Styles.StyleSeriesItemLabel.ItemLabelLocation.Inside;
                Series2_1.Items[0].Label.Appearance.Position.AlignedPosition = Telerik.Charting.Styles.AlignedPositions.Left;
                Series2_1.Items[0].Label.Appearance.Visible = true;
                Series2_1.Items[0].Appearance.Border.Color = Color.Transparent;
                Series2_2.AddItem(itm2.AdministrativeServicesToConcept, "To Concept");
                Series2_2.Items[0].Appearance.FillStyle.MainColor = Color.FromArgb(150, 245, 84, 117);
                Series2_2.Items[0].Appearance.FillStyle.SecondColor = Color.FromArgb(150, 245, 84, 117);
                Series2_2.Items[0].Appearance.Border.Color = Color.Transparent;
                Series2_2.Items[0].Label.Appearance.LabelLocation = Telerik.Charting.Styles.StyleSeriesItemLabel.ItemLabelLocation.Outside;
                Series2_2.Items[0].Label.Appearance.Position.AlignedPosition = Telerik.Charting.Styles.AlignedPositions.Left;
                Series2_3.AddItem(itm2.AdministrativeServicesApproved, "Approved");
                Series2_3.Items[0].Appearance.FillStyle.MainColor = Color.FromArgb(50, 245, 84, 117);
                Series2_3.Items[0].Appearance.FillStyle.SecondColor = Color.FromArgb(50, 245, 84, 117);
                Series2_3.Items[0].Appearance.Border.Color = Color.Transparent;
                Series2_3.Items[0].Label.Appearance.LabelLocation = Telerik.Charting.Styles.StyleSeriesItemLabel.ItemLabelLocation.Outside;
                Series2_3.Items[0].Label.Appearance.Position.AlignedPosition = Telerik.Charting.Styles.AlignedPositions.Left;
                Series2_4.AddItem(itm2.AdministrativeServicesDenied, "Denied");
      
                Series2_1.AddItem(itm2.AuditAndInspectionServices, "Audit And Inspection Services");
                Series2_1.Items[1].Appearance.FillStyle.MainColor = Color.FromArgb(250, 146, 183, 192);
                Series2_1.Items[1].Appearance.FillStyle.SecondColor = Color.FromArgb(250, 146, 183, 192);
                Series2_1.Items[1].ActiveRegion.Url = "DashboardDetails.aspx?c=AIS";
                Series2_1.Items[1].ActiveRegion.Tooltip = "Audit And Inspection Services";
                Series2_1.Items[1].Label.Appearance.LabelLocation = Telerik.Charting.Styles.StyleSeriesItemLabel.ItemLabelLocation.Inside;
                Series2_1.Items[1].Label.Appearance.Position.AlignedPosition = Telerik.Charting.Styles.AlignedPositions.Left;
                Series2_1.Items[1].Appearance.Border.Color = Color.Transparent;
                Series2_2.AddItem(itm2.AuditAndInspectionToConceptServices);
                Series2_2.Items[1].Label.TextBlock.Text = "To Concept";
                if (itm2.AuditAndInspectionToConceptServices != 0)
                {
                    Series2_2.Items[1].Label.Appearance.Visible = true;
                    Series2_2.Items[1].Label.TextBlock.Text = "To Concept";
                }
                  
                Series2_2.Items[1].Appearance.FillStyle.MainColor = Color.FromArgb(250, 146, 183, 192);
                Series2_2.Items[1].Appearance.FillStyle.MainColor = Color.FromArgb(250, 146, 183, 192);
                Series2_2.Items[1].Appearance.Border.Color = Color.Transparent;
                Series2_3.AddItem(itm2.AuditAndInspectionApprovedServices, "Approved");
                if (itm2.AuditAndInspectionApprovedServices == 0)
                {
                    Series2_3.Items[1].Label.Appearance.Visible = false;
                }
                Series2_3.Items[1].Appearance.FillStyle.MainColor = Color.FromArgb(250, 146, 183, 192);
                Series2_3.Items[1].Appearance.FillStyle.MainColor = Color.FromArgb(250, 146, 183, 192);
                Series2_3.Items[1].Appearance.Border.Color = Color.Transparent;
      
                Series2_1.AddItem(itm2.DisputeResolution, "Dispute Resolution");
                Series2_1.Items[2].Appearance.FillStyle.MainColor = Color.FromArgb(250, 248, 142, 162);
                Series2_1.Items[2].Appearance.FillStyle.SecondColor = Color.FromArgb(250, 248, 142, 162);
                Series2_1.Items[2].ActiveRegion.Url = "DashboardDetails.aspx?c=DR";
                Series2_1.Items[2].ActiveRegion.Tooltip = "Dispute Resolution";
                Series2_1.Items[2].Label.Appearance.LabelLocation = Telerik.Charting.Styles.StyleSeriesItemLabel.ItemLabelLocation.Inside;
                Series2_1.Items[2].Label.Appearance.Position.AlignedPosition = Telerik.Charting.Styles.AlignedPositions.Left;
                Series2_2.AddItem(itm2.DisputeResolutionToConcept, " To Concept");
                Series2_2.Items[2].Appearance.FillStyle.MainColor = Color.FromArgb(250, 248, 142, 162);
                Series2_2.Items[2].Appearance.FillStyle.SecondColor = Color.FromArgb(250, 248, 142, 162);
                Series2_3.AddItem(itm2.DisputeResolutionApproved, "Approved");
                Series2_3.Items[2].Appearance.FillStyle.MainColor = Color.FromArgb(250, 248, 142, 162);
                Series2_3.Items[2].Appearance.FillStyle.SecondColor = Color.FromArgb(250, 248, 142, 162);
      
      
                Series2_1.AddItem(itm2.EnforceCompliance, "Enforce Compliance");
                Series2_1.Items[3].Appearance.FillStyle.MainColor = Color.FromArgb(250, 83, 131, 143);
                Series2_1.Items[3].Appearance.FillStyle.SecondColor = Color.FromArgb(250, 83, 131, 143);
                Series2_1.Items[3].ActiveRegion.Url = "DashboardDetails.aspx?c=EC";
                Series2_1.Items[3].ActiveRegion.Tooltip = "Enforce Compliance";
                Series2_1.Items[3].Label.Appearance.LabelLocation = Telerik.Charting.Styles.StyleSeriesItemLabel.ItemLabelLocation.Inside;
                Series2_1.Items[3].Label.Appearance.Position.AlignedPosition = Telerik.Charting.Styles.AlignedPositions.Left;
                Series2_2.AddItem(itm2.EnforceComplianceToConcept, "To Concept");
      
      
                Series2_1.AddItem(itm2.PaymentServices, "Payment Service");
                Series2_1.Items[4].Appearance.FillStyle.MainColor = Color.FromArgb(250, 197, 216, 255);
                Series2_1.Items[4].Appearance.FillStyle.SecondColor = Color.FromArgb(250, 197, 216, 255);
                Series2_1.Items[4].ActiveRegion.Url = "DashboardDetails.aspx?c=PS";
                Series2_1.Items[4].ActiveRegion.Tooltip = "Payment Service";
                Series2_1.Items[4].Label.Appearance.LabelLocation = Telerik.Charting.Styles.StyleSeriesItemLabel.ItemLabelLocation.Inside;
                Series2_1.Items[4].Label.Appearance.Position.AlignedPosition = Telerik.Charting.Styles.AlignedPositions.Left;
                Series2_2.AddItem(itm2.PaymentServicesToConcept, "To Concept");
      
      
                Series2_1.AddItem(itm2.PropertyOwnerContractManagement, "Property Owner Contract Management");
                Series2_1.Items[5].Appearance.FillStyle.MainColor = Color.FromArgb(250, 122, 172, 181);
                Series2_1.Items[5].Appearance.FillStyle.SecondColor = Color.FromArgb(250, 122, 172, 181);
                Series2_1.Items[5].ActiveRegion.Url = "DashboardDetails.aspx?c=POCM";
                Series2_1.Items[5].ActiveRegion.Tooltip = "Property Owner Contract Management";
                Series2_1.Items[5].Label.Appearance.LabelLocation = Telerik.Charting.Styles.StyleSeriesItemLabel.ItemLabelLocation.Inside;
                Series2_1.Items[5].Label.Appearance.Position.AlignedPosition = Telerik.Charting.Styles.AlignedPositions.Left;
                Series2_2.AddItem(itm2.PropertyOwnerContractManagementToConcept, "To Concept");
      
      
                Series2_1.AddItem(itm2.TenantServices, "Tenant Service");
                Series2_1.Items[6].Appearance.FillStyle.MainColor = Color.FromArgb(250, 187, 212, 217);
                Series2_1.Items[6].Appearance.FillStyle.SecondColor = Color.FromArgb(250, 187, 212, 217);
                Series2_1.Items[6].ActiveRegion.Url = "DashboardDetails.aspx?c=TS";
                Series2_1.Items[6].ActiveRegion.Tooltip = "Tenant Service";
                Series2_1.Items[6].Label.Appearance.LabelLocation = Telerik.Charting.Styles.StyleSeriesItemLabel.ItemLabelLocation.Inside;
                Series2_1.Items[6].Label.Appearance.Position.AlignedPosition = Telerik.Charting.Styles.AlignedPositions.Left;
                Series2_2.AddItem(itm2.TenantServicesToConcept, "To Concept");
      
                 
                 
                RadChart2.PlotArea.XAxis.AutoScale = false;
                RadChart2.PlotArea.XAxis.AddRange(1, 7, 1);
                RadChart2.PlotArea.XAxis.Appearance.LabelAppearance.Visible = false;
                RadChart2.PlotArea.XAxis.Appearance.LabelAppearance.RotationAngle = 0;
               
      
                Series2_1.Appearance.TextAppearance.TextProperties.Color = Color.Black;
                Series2_2.Appearance.TextAppearance.TextProperties.Color = Color.Black;
                Series2_3.Appearance.TextAppearance.TextProperties.Color = Color.Black;
                Series2_1.Appearance.BarWidthPercent = 90;
                Series2_2.Appearance.BarWidthPercent = 90;
                Series2_3.Appearance.BarWidthPercent = 90;
                Series2_1.Items[0].Label.Appearance.LabelLocation = Telerik.Charting.Styles.StyleSeriesItemLabel.ItemLabelLocation.Inside;
                Series2_1.Items[0].Label.Appearance.Position.AlignedPosition = Telerik.Charting.Styles.AlignedPositions.Left;
                 
  5. Evgenia
    Admin
    Evgenia avatar
    1406 posts

    Posted 21 May 2012 Link to this post

    Hello Scott ,

    It is hard for me to say what could be the possible reason for this unwanted behavior based on the provided information.
    I tried to reproduce it with the following code and it behaves as expected on my side:

    RadChart RadChart1 = new RadChart();
      
    ChartSeries series1 = new ChartSeries();
    series1.AddItem(50, "Administrative Services", Color.Black);
    series1.Items[0].Appearance.FillStyle.MainColor = Color.FromArgb(250, 245, 84, 117);
    series1.Items[0].Appearance.FillStyle.SecondColor = Color.FromArgb(250, 245, 84, 117);
    series1.Items[0].Label.Appearance.LabelLocation = StyleSeriesItemLabel.ItemLabelLocation.Inside;
    series1.Items[0].Label.Appearance.Position.AlignedPosition = AlignedPositions.Bottom;
    RadChart1.Series.Add(series1);
      
    ChartSeries series2 = new ChartSeries();
    series2.AddItem(70, "My Label", Color.Black);
    series2.Items[0].Appearance.FillStyle.MainColor = Color.FromArgb(250, 245, 84, 117);
    series2.Items[0].Appearance.FillStyle.SecondColor = Color.FromArgb(250, 245, 84, 117);
    series2.Items[0].Label.Appearance.LabelLocation = StyleSeriesItemLabel.ItemLabelLocation.Inside;
    series2.Items[0].Label.Appearance.Position.AlignedPosition = AlignedPositions.Center;
    RadChart1.Series.Add(series2);
      
    RadChart1.AutoLayout = true;
      
    RadChart1.SeriesOrientation = ChartSeriesOrientation.Horizontal;
    this.Page.Controls.Add(RadChart1);

    Could you attach your runnable code sample so that we will be able to investigate what might be causing this on your side and get back to you with our feedback based on the code?

    NOTE: You are not allowed to attach archived files in our forums so you may need to use a third party site where your project can be uploaded and just provide us the link to it.

    Regards,
    Evgenia
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top