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
1470
Questions using Legends
posted

Hi there

I am using 12.1.20121.2054 of the UltraChart and am having troubles with my chart's legend. The chart is a composite chart made up of a ColumnChart and a Line chart

1/ I have assigned the Legend.Location = LegendLocation.Bottom but it still appears at the top right hand side of the chart. How can I affect this location?


            ultraChart1.Legend.DataAssociation = ChartTypeData.SplitData;
            // Add a Legend
            CompositeLegend chartLegend = new CompositeLegend();
            columnLayer.LegendItem = LegendItemType.Series;
            lineLayer.LegendItem = LegendItemType.Series;
            chartLegend.ChartLayers.Add(columnLayer);
            chartLegend.ChartLayers.Add(lineLayer);
            ultraChart1.CompositeChart.Legends.Add(chartLegend);
            this.ultraChart1.Legend.Location = LegendLocation.Bottom;

2/ You will notice under the X axis it has the term "Monthly".
    I do not want to display this value, in fact I want to hide that value, but if I set the Series.Label to string.Empty or modify the label
     the legend text is also affected. How can hide the series label but leave the legend label as :Monthly" ?
   

Regards

geoffhop

Parents
  • 53790
    posted

    Hello geoffhop,

    geoffhop said:
    1/ I have assigned the Legend.Location = LegendLocation.Bottom but it still appears at the top right hand side of the chart. How can I affect this location?

    Looking at the provided code, the mentioned behavior is expected, because:

    -   this.ultraChart1.Legend.Location - this property could be use for default legend, but when you are using Composite Legend you should specify the size and location of the legend using for example :

    CompositeLegend m_ChartLegend = new CompositeLegend();

    ColumnLayer.LegendItem = LegendItemType.Series;

    LineLayer.LegendItem = LegendItemType.Series;

    m_ChartLegend.ChartLayers.Add(ColumnLayer);

    m_ChartLegend.ChartLayers.Add(LineLayer);

    m_ChartLegend.BoundsMeasureType = MeasureType.Percentage;

    m_ChartLegend.Bounds = new Rectangle(1, 10, 18, 20);

    geoffhop said:
     2/ You will notice under the X axis it has the term "Monthly".     I do not want to display this value, in fact I want to hide that value, but if I set the Series.Label to string.Empty or modify the label      the legend text is also affected. How can hide the series label but leave the legend label as :Monthly" ?

    Could you please zip and upload again your screenshot, because we didn`t received it, but looking at the provided information, I think that you are using wrong property, because X axis lables could be hidden when using a :

    AxisItem xAxis = new AxisItem();

    xAxis.DataType = AxisDataType.String;

    ......

    xAxis.OrientationType = AxisNumber.X_Axis;

    xAxis.Labels.Visible = false;

     

    Let me know if you have any questions.

    Regards

Reply Children