Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
690
How to set a minimum width for an Axis' label in a bar chart?
posted

Is there a way to ensure the Labels in an Axis take a certain width? I'm using a bar chart and one of the data points has a long label - I'd like to make sure in the default chart's width/height (roughly 200x200) that all labels are readable.

I have a hunch I need to change something here:

          <igCA:Axis AxisType="PrimaryX">
            <igCA:Axis.Label>
              <igCA:Label FontSize="14"/>
            </igCA:Axis.Label>
          </igCA:Axis>

But the help file "Infragistics.Windows.Chart Namespace > Axis Class : Label Property" only says "Gets or sets the Axis Labels".  The xamFeatureBrowser has no example to implement this minimum width for bar chart labels either.

I can take some screenshots to make this question a bit more clear if needed.

Here's my sample chart:

      <igCA:XamChart x:Name="xcSample" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Grid.Row="0"
                     Style="{StaticResource XamChartStyle}" StartPaletteBrush="#FF076CB0"  >
        <!-- Legend -->
        <igCA:XamChart.Legend>
          <igCA:Legend Visible="False"/>
        </igCA:XamChart.Legend>
        <!-- Series -->
        <igCA:XamChart.Series>
          <igCA:Series Label="MySampleChart" ChartType="Bar">
            <igCA:Series.ChartParameters>
              <igCA:ChartParameter Type="PointWidth" Value="1.4"/>
            </igCA:Series.ChartParameters>
            <igCA:Series.Animation>
              <igCA:Animation BeginTime="00:00:01.25" Sequential="False"/>
            </igCA:Series.Animation>
            <igCA:Series.DataPoints>
              <igCA:DataPoint Value="0.05" Label="Sample 1" ToolTip="Sample 1 Tooltip"/>
              <igCA:DataPoint Value="0.09" Label="Sample 2"/>
              <igCA:DataPoint Value="0.10" Label="Sample 3"/>
              <igCA:DataPoint Value="0.11" Label="Very long Sample 4"/>
              <igCA:DataPoint Value="0.14" Label="Sample 5"/>
              <igCA:DataPoint Value="0.18" Label="Sample 6"/>
              <igCA:DataPoint Value="0.27" Label="Sample 7"/>
            </igCA:Series.DataPoints>
            <igCA:Series.Marker>
              <igCA:Marker Foreground="#FFFFFFFF"/>
            </igCA:Series.Marker>
          </igCA:Series>
        </igCA:XamChart.Series>
        <!-- Axes -->
        <igCA:XamChart.Axes>
          <igCA:Axis AxisType="PrimaryX">
            <igCA:Axis.Label>
              <igCA:Label FontSize="14"/>
            </igCA:Axis.Label>
            <igCA:Axis.MajorGridline>
              <igCA:Mark Stroke="#FFECE6D9"/>
            </igCA:Axis.MajorGridline>
          </igCA:Axis>
          <igCA:Axis AxisType="PrimaryY" AutoRange="False" Minimum="0" Maximum="0.30" Unit="0.10">
            <igCA:Axis.Label>
              <igCA:Label FontSize="14" Format="{}{0:p0}"/>
            </igCA:Axis.Label>
            <igCA:Axis.Stripes>
              <igCA:Stripe Fill="#FFECE6D9" Stroke="#004083C8"/>
            </igCA:Axis.Stripes>
          </igCA:Axis>
          <igCA:Axis AxisType="PrimaryZ">
            <igCA:Axis.Label>
              <igCA:Label FontSize="14" Visible="False" Foreground="#00000000"/>
            </igCA:Axis.Label>
          </igCA:Axis>
        </igCA:XamChart.Axes>
        <igCA:XamChart.Caption>
          <igCA:Caption FontFamily="Arial" FontSize="16" FontStretch="Expanded" FontWeight="SemiBold" Text="My Sample Chart" />
        </igCA:XamChart.Caption>
      </igCA:XamChart>

 

 

Parents Reply Children