template without data

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Adam
Newbie
Newbie
Posts: 17
Joined: Tue Nov 06, 2012 12:00 am

template without data

Post by Adam » Fri Mar 01, 2013 12:50 pm

Hello.

I'm saving template of an existing chart to a file.
Then I would like to apply this template to another chart, but this second chart has already it's data. I don't want to overwrite this data so I use template without data.

But then:
- if I apply a template (with IncludingData = False) to an existing chart all chart data is cleared (all series)
- so I have to restore chart's data from my tables, but then new series that I have to create will not get my template's settings (like series colour, marks visibility for instance).

So, is it possible to copy all visual chart settings (including series settings) from one chart to another when the second chart has already it's data and we don't want to change it?

I would like to save template of my sample chart (chart that I change a lot in chart editor to get the best look and feel) and then have possibility to apply this saved template to other charts that I will first create with default setting (from gallerypanel for instance).

regards, Adam

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: template without data

Post by Sandra » Mon Mar 04, 2013 4:18 pm

Hello Adam,

I think, if you only want save the Chart aspect can be useful save your aspect information in a custom theme. As do in next code:

Code: Select all

      public Form1()
        {
            InitializeComponent();
            InitializeChart();
        }
        private void InitializeChart()
        {
            Steema.TeeChart.Styles.Line line1, line2;
            line1 = new Line(tChart1.Chart);
            line2 = new Line(tChart2.Chart);
            line1.FillSampleValues();
            line2.FillSampleValues();

            for (int i = 0; i < tChart1.Axes.Count;   i)
            {
                Axis a = tChart1.Axes[i];
                a.Labels.Font.Name = "Verdana";
                a.Labels.Font.Size = 7;
            }

            tChart1.Aspect.View3D = false;
            tChart1.Header.Font.Name = "Verdana";
            tChart1.Header.Font.Size = 9;
            tChart1.Legend.Font.Name = "Verdana";
            tChart1.Legend.Font.Size = 7;

            tChart1.Panel.Gradient.Visible = true;
            tChart1.Panel.Gradient.StartColor = Color.AliceBlue;
            tChart1.Panel.Gradient.MiddleColor = Color.SeaShell;
            tChart1.Panel.Gradient.EndColor = Color.Khaki;

            tChart1.Panel.Bevel.Inner = Steema.TeeChart.Drawing.BevelStyles.Raised;
            tChart1.Panel.Bevel.Outer = Steema.TeeChart.Drawing.BevelStyles.None;

            tChart1.Export.Theme.Save(@"C:\Theme.xml");
            tChart2.Import.Theme.Load(@"C:\Theme.xml");

        }
Could you tell us if previous code works in your end?If you have any problemes please let me know.

Thanks,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply