Page 1 of 1

Chartbook

Posted: Fri Jul 29, 2011 7:56 am
by 15658604
Hi,

i have some questions arround the Chartbook tools.

Is it possible to disable the includes Contextmenü?

Is the the possibility to export Charts from an Chartbook as bulk?

Thanks

Re: Chartbook

Posted: Mon Aug 01, 2011 1:50 pm
by 10050769
Hello AGF,

I have made a simple example where you can see how you do to delete/add Items in MenuContext and how to export Charts of ChartBook as bulk:

Code: Select all

        public Form1()
        {
            InitializeComponent();
            InitializeChart();

        }
        Steema.TeeChart.TChart tChart;
        Steema.TeeChart.ChartBook chartBook1;
        MenuItem menuItemadd; // MenuItem. 
        private void InitializeChart()
        {
            //InitializeChartBook.
            chartBook1 = new Steema.TeeChart.ChartBook();
            this.Controls.Add(chartBook1);
            chartBook1.Dock = DockStyle.Fill;

            chartBook1.Alignment = TabAlignment.Left;
            chartBook1.AddChart().Series.Add(typeof(Steema.TeeChart.Styles.Line)).FillSampleValues();
            chartBook1.AddChart().Series.Add(typeof(Steema.TeeChart.Styles.Bar)).FillSampleValues();
            chartBook1.AddChart().Series.Add(typeof(Steema.TeeChart.Styles.Area)).FillSampleValues();
            chartBook1.AddChart().Series.Add(typeof(Steema.TeeChart.Styles.Pie)).FillSampleValues();

            chartBook1.SelectedIndex = 0;//To default is, so if it is not necessary. 
            
            //Export All Charts.
            for (int i = 0; i < chartBook1.TabPages.Count; i++)
            {
                tChart = (Steema.TeeChart.TChart)chartBook1.TabPages[i].Controls[0];
                tChart.Export.Image.JPEG.Save(@"C:\tmp\ChartBook" + i.ToString() + ".jpg");
            }
        }
        private void RemoveMenuItems_Click(object sender, EventArgs e)
        {
            //example as you do to remove items. 
            chartBook1.ContextMenu.MenuItems.Remove(menuItemadd);
        }

        private void AddMenuItems_Click(object sender, EventArgs e)
        {
            //Example as you do to add items.
             menuItemadd = new MenuItem("NewName");
            chartBook1.ContextMenu.MenuItems.Add(menuItemadd);
        }
Could you please, tell us if previous code works as you expected?

I hope will helps.

Thanks,