private void BarItem_ListItemClick(object sender, ListItemClickEventArgs e)
        {
            ChartDashboardItem dashboardItem = dashboardDesigner.SelectedDashboardItem as ChartDashboardItem;
            MultiPaneSettings  settings      = MultiPaneSettings.FromJson(dashboardItem.CustomProperties[customPropertyName]);

            settings.UseGridLayout = e.Index == 0;
            string status = settings.UseGridLayout == true ? "Grid" : "Linear";
            CustomPropertyHistoryItem historyItem = new CustomPropertyHistoryItem(dashboardItem, customPropertyName, settings.ToJson(), $"Layout Mode for {dashboardItem.ComponentName} is {status}");

            dashboardDesigner.AddToHistory(historyItem);
            UpdateBarItems();
        }
        void OnAllowCollapsingClick(object sender, ItemClickEventArgs e)
        {
            ChartDashboardItem dashboardItem = dashboardDesigner.SelectedDashboardItem as ChartDashboardItem;
            MultiPaneSettings  settings      = MultiPaneSettings.FromJson(dashboardItem.CustomProperties[customPropertyName]);

            settings.AllowPaneCollapsing = !settings.AllowPaneCollapsing;
            string status = settings.AllowPaneCollapsing == true ? "enabled" : "disabled";
            CustomPropertyHistoryItem historyItem = new CustomPropertyHistoryItem(dashboardItem, customPropertyName, settings.ToJson(), $"Pane Collapsing for {dashboardItem.ComponentName} is {status}");

            dashboardDesigner.AddToHistory(historyItem);
            UpdateBarItems();
        }
        private void DashboardItemControlUpdated(object sender, DashboardItemControlEventArgs e)
        {
            ChartDashboardItem chartItem = dashboardControl.Dashboard.Items[e.DashboardItemName] as ChartDashboardItem;

            if (chartItem == null || chartItem.Panes.Count > 1)
            {
                return;
            }
            MultiPaneSettings settings = MultiPaneSettings.FromJson(chartItem.CustomProperties[customPropertyName]);

            CustomizeDiagram(e.ChartControl.Diagram as XYDiagram, e.ChartControl.Series, settings);
        }
 void CustomizeDiagram(XYDiagram diagram, SeriesCollection series, MultiPaneSettings settings)
 {
     if (settings.MultiPaneEnabled)
     {
         diagram.PaneLayout.AutoLayoutMode = settings.UseGridLayout ? PaneAutoLayoutMode.Grid : PaneAutoLayoutMode.Linear;
         diagram.RuntimePaneCollapse       = settings.AllowPaneCollapsing;
         List <Series> seriesWithPoints = series.Cast <Series>().Where(s => s.Points.Any()).ToList();
         for (int i = 0; i < seriesWithPoints.Count; i++)
         {
             if (i != 0)
             {
                 diagram.Panes.Add(new XYDiagramPane());
             }
             XYDiagramPane pane = diagram.Panes[i];
             (seriesWithPoints[i].View as XYDiagramSeriesViewBase).Pane = pane;
             if (settings.ShowPaneTitles)
             {
                 pane.Title.Visibility = DevExpress.Utils.DefaultBoolean.True;
                 pane.Title.Text       = seriesWithPoints[i].Name;
             }
             else
             {
                 pane.Title.Visibility = DevExpress.Utils.DefaultBoolean.False;
             }
         }
         //foreach (XYDiagramPane pane in diagram.Panes)
         //{
         //    if (diagram.Rotated)
         //    {
         //        if (pane == diagram.Panes[0])
         //            diagram.AxisX.SetVisibilityInPane(true, pane);
         //        else
         //            diagram.AxisX.SetVisibilityInPane(false, pane);
         //    }
         //    else //not rotated
         //    {
         //        if (pane == diagram.Panes[diagram.Panes.Count - 1])
         //            diagram.AxisX.SetVisibilityInPane(true, pane);
         //        else
         //            diagram.AxisX.SetVisibilityInPane(false, pane);
         //    }
         //}
     }
 }
 void UpdateBarItems()
 {
     if (dashboardDesigner.SelectedDashboardItem is ChartDashboardItem)
     {
         ChartDashboardItem chartItem = dashboardDesigner.SelectedDashboardItem as ChartDashboardItem;
         if (chartItem.Panes.Count > 1)
         {
             enableBarItem.Checked = showTitlesBarItem.Checked = allowCollapsingBarItem.Checked = false;
             enableBarItem.Enabled = showTitlesBarItem.Enabled =
                 allowCollapsingBarItem.Enabled = layoutModeBarItem.Enabled = false;
             return;
         }
         MultiPaneSettings settings = MultiPaneSettings.FromJson(chartItem.CustomProperties[customPropertyName]);
         enableBarItem.Enabled = true;
         enableBarItem.Checked = settings.MultiPaneEnabled;
         if (settings.MultiPaneEnabled)
         {
             layoutModeBarItem.Enabled = true;
             showTitlesBarItem.Enabled = true;
             showTitlesBarItem.Checked = settings.ShowPaneTitles;
         }
         else
         {
             layoutModeBarItem.Enabled = false;
             showTitlesBarItem.Enabled = false;
             showTitlesBarItem.Checked = false;
         }
         if (settings.MultiPaneEnabled && settings.ShowPaneTitles)
         {
             allowCollapsingBarItem.Enabled = true;
             allowCollapsingBarItem.Checked = settings.AllowPaneCollapsing;
         }
         else
         {
             allowCollapsingBarItem.Enabled = false;
             allowCollapsingBarItem.Checked = false;
         }
         layoutModeBarItem.ItemIndex = settings.UseGridLayout? 0:1;
     }
 }
 private void CustomExport(object sender, CustomExportEventArgs e)
 {
     foreach (var printControl in e.GetPrintableControls())
     {
         if (printControl.Value is XRChart)
         {
             var chartItemName = printControl.Key;
             IDashboardControl  dashboardControl = (IDashboardControl)sender;
             ChartDashboardItem chartItem        = dashboardControl.Dashboard.Items[chartItemName] as ChartDashboardItem;
             if (chartItem == null || chartItem.Panes.Count > 1)
             {
                 return;
             }
             XRChart xrChart = printControl.Value as XRChart;
             if (xrChart == null)
             {
                 return;
             }
             MultiPaneSettings settings = MultiPaneSettings.FromJson(chartItem.CustomProperties[customPropertyName]);
             CustomizeDiagram(xrChart.Diagram as XYDiagram, xrChart.Series, settings);
         }
     }
 }