Chart label not fully display after rotated into -90 and set smartlabelstyle into false

27 Views Asked by At

I'm having a problem where my chart label does not fully display after I set it to vertical. In order to change horizontal into vertical I set label angle to -90 and set smartlabelstyle to false as you can see from the code below:

        Chart5.DataSource = dv;
        Chart5.Series["Series1"].Points.DataBindXY(dt2.DefaultView, "DepartmentPSATA", dt2.DefaultView, "value");
        Chart5.DataManipulator.GroupByAxisLabel("SUM", "*");
        Chart5.AlignDataPointsByAxisLabel();
        Chart5.ChartAreas[0].AxisX.Interval = 1;



        foreach (Series ser in Chart5.Series)
        {
            ser.IsValueShownAsLabel = true;
            ser.IsVisibleInLegend = false;

            ser.LabelToolTip = "#VALX: RM#VALY mil";
            ser.LabelForeColor = Color.Black;

            ser.LabelFormat = "#0.00 mil";

            ser.LabelAngle = -90; //this line
            ser.SmartLabelStyle.Enabled = false; //this line

            switch (ser.Name)
            {
                case "Value Creation": ser.Color = Color.FromArgb(30, 161, 133); break;
                case "Estimated Investment Value": ser.Color = Color.FromArgb(0, 51, 153); break;
            }

            foreach (DataPoint point in ser.Points)
            {
                if (point.YValues.Length > 0 && (double)point.YValues.GetValue(0) == 0)
                {
                    point.IsValueShownAsLabel = true;
                }
            }
        }



<asp:Chart ID="Chart5" runat="server" Width="1235px" Height="800px" BorderlineColor="Black">
                <Series>
                    <asp:series Name="Series1" Legend="Legend1" ChartArea="ChartArea1" Color="68, 114, 196" IsVisibleInLegend="False">
                    </asp:series>
                </Series>
                <ChartAreas>
                    <asp:chartarea Name="ChartArea1">
                        <AxisY Title="Total Estimated Cost (RM)">
                            <MajorGrid LineColor="Silver" Enabled="False" />
                        </AxisY>
                        <AxisX Title="Division">
                            <MajorGrid LineColor="Silver" Enabled="False" />
                        </AxisX>
                    </asp:chartarea>
                </ChartAreas>
                <Legends>
                    <asp:legend Name="Legend1" Alignment="Center" Docking="Bottom">
                    </asp:legend>
                </Legends>
                <Titles>
                    <asp:title Name="Title1" Visible="False" Text="Total Close Deal Value by Division" Font="Microsoft Sans Serif, 12pt, style=Bold" ForeColor="DarkBlue">
                    </asp:title>
                    <asp:title Name="Title3" Visible="False" DockedToChartArea="ChartArea1" Text="No Records" Font="Microsoft Sans Serif, 12pt">
                    </asp:title>
                </Titles>
                <BorderSkin BorderColor="Transparent" />
            </asp:Chart>

i try to fix this by adding

Chart5.ChartAreas[0].InnerPlotPosition.Auto = true;

but it seems the label chart still did not fully display (i get the same results) as image shown below:

enter image description here

How do i fix this?

0

There are 0 best solutions below