Beispiel #1
0
        private void InteractivityToolComboBox_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            nChartControl1.Controller.Tools.Clear();

            switch (InteractivityToolComboBox.SelectedIndex)
            {
            case 0:
                NPanelSelectorTool selector = new NPanelSelectorTool();
                selector.Focus = true;

                nChartControl1.Controller.Tools.Add(selector);
                nChartControl1.Controller.Tools.Add(new NAxisScrollTool());
                nChartControl1.Controller.Tools.Add(m_DataZoomTool);
                break;

            case 1:
                nChartControl1.Controller.Tools.Add(new NTrackballTool());
                break;

            case 2:
                nChartControl1.Controller.Tools.Add(new NZoomTool());
                break;

            case 3:
                nChartControl1.Controller.Tools.Add(new NOffsetTool());
                break;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!NThinChartControl1.Initialized)
            {
                // get the default chart 
                NThinChartControl1.Panels.Clear();
                NThinChartControl1.BackgroundStyle.FrameStyle.Visible = false;
                NThinChartControl1.Settings.EnableJittering = true;

                // set a chart title
                NLabel title = NThinChartControl1.Labels.AddHeader("Panel Selector Tool");
                title.TextStyle.TextFormat = GraphicsCore.TextFormat.XML;
                title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic);
                title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur;
                title.DockMode = PanelDockMode.Top;

                NDockPanel contentPanel = new NDockPanel();
                contentPanel.DockMode = PanelDockMode.Fill;

                // create the first pie chart
                NPieChart pieChart1 = CreatePieChart();
                pieChart1.Location = new NPointL(0, 0);
                pieChart1.Size = new NSizeL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(100, NRelativeUnit.ParentPercentage));
                contentPanel.ChildPanels.Add(pieChart1);

                // create the second pie chart
                NPieChart pieChart2 = CreatePieChart();
                pieChart2.Location = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(0));
                pieChart2.Size = new NSizeL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(100, NRelativeUnit.ParentPercentage));
                contentPanel.ChildPanels.Add(pieChart2);

                NThinChartControl1.Panels.Add(contentPanel);

                // apply style sheet
                NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.BrightMultiColor);
                styleSheet.Apply(NThinChartControl1.Document);

                // add panel selector and trackball tools
                NPanelSelectorTool panelSelector = new NPanelSelectorTool();
                panelSelector.ActivatePanelCallback = new ActivatePanelCallback();
                NThinChartControl1.Controller.Tools.Add(panelSelector);

                NThinChartControl1.Controller.Tools.Add(new NTrackballTool());
            }
        }