Ticket T661782
Visible to All Users

Dashboard - CheckedLegend State not working in Maximize Mode.

created 7 years ago

I have an ChartDashboardItem with CheckedLegend.When I Maximize the ChartDashboardItem,the state of Checked Legend is not working.Please check attached screencast and advise how to do that…

Answers approved by DevExpress Support

created 7 years ago (modified 7 years ago)

Hi Junaid,

To display an item in maximized mode, we create a new instance of this item. Then, we apply the state of the initial item (a master filter, drill down, etc.) to the maximized item and display the maximized item over the dashboard. Although the DashboardItemControlCreated / DashboardItemControlUpdated events are raised for the maximized item, we cannot apply custom states (like unchecked series in the legend) to it automatically. You would need to apply this custom state manually.

For instance, you can store unchecked series names in a separate storage:

C#
List<string> uncheckedSeries = new List<string>(); private void ChartControl_LegendItemChecked(object sender, DevExpress.XtraCharts.LegendItemCheckedEventArgs e) { ChartControl chart = (ChartControl)sender; if (e.CheckedElement is Series) { var series = (Series)e.CheckedElement; chart.Series[series.LegendTextPattern].Visible = e.NewCheckState; //save unchecked series and remove checked ones if (!e.NewCheckState) uncheckedSeries.Add(series.LegendTextPattern); else if (uncheckedSeries.Contains(series.LegendTextPattern)) uncheckedSeries.Remove(series.LegendTextPattern); } }

And modify series according to series names stored in this storage in the DashboardItemControlUpdated event handler:

C#
private void DashboardDesigner1_DashboardItemControlUpdated(object sender, DevExpress.DashboardWin.DashboardItemControlEventArgs e) { if (e.ChartControl!= null) { foreach(Series series in e.ChartControl.Series) { series.Visible = !uncheckedSeries.Contains(series.Name); series.CheckedInLegend = !uncheckedSeries.Contains(series.LegendTextPattern); } } } private void dashboardDesigner1_DashboardItemControlCreated(object sender, DevExpress.DashboardWin.DashboardItemControlEventArgs e) { if (e.ChartControl != null) { e.ChartControl.Legend.MarkerMode = DevExpress.XtraCharts.LegendMarkerMode.CheckBoxAndMarker; e.ChartControl.LegendItemChecked += ChartControl_LegendItemChecked; } }
    Show previous comments (2)
    JA JA
    Junaid Ahmed 3 7 years ago

      Sorry for late reply…

      I have again an issue in Checked Legend When I Maximize.

      Pls check and help…

      JA JA
      Junaid Ahmed 3 7 years ago

        awaiting for reply…

        DevExpress Support Team 7 years ago

          Hi Junaid,

          We published the How to Apply the ChartControl CheckedLegend State to the Maximized ChartDashboardItem example demonstrating how to show checkboxes in chart items' legend and synchronize the checked state between maximized and minimized items. Try this approach in your application and let me know whether it operates correctly.

          Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

          Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.