|
string currentTemplate = "Column_Square.xml";
private void ChartType_Click(object sender, EventArgs e)
{
if (chartButton == this.buttonAdv2)
{
this.buttonAdv2.State = ButtonAdvState.Pressed;
this.buttonAdv2.Enabled = false;
currentTemplate = "Column_Square.xml";
}
ChartTemplate.Load(this.chartControl1, currentTemplate);
} |
|
//Saves file to a new template
saveTemplateFile = "Template" + ".xml";
ChartTemplate.Save(this.chartControl1, saveTemplateFile); |
|
[C#]
//ChartTemplate.Save(this.chartControl1, currentTemplate);
ChartTemplate template = new ChartTemplate(this.chartControl1.GetType()); //Specify whether chart series should also be saved in template
//Value for this property was previously obtained from user through message box ChartTemplate.StoreAllProperties = false; //Scan the chart control
template.Scan(this.chartControl1); //Save the chartcontrol in XML file template.Save(currentTemplate); |
|
[C#]
saveTemplateFile = "Template" + templateCount.ToString() + ".xml";
MemoryStream stream = new MemoryStream();
ChartTemplate.StoreAllProperties = true;
ChartTemplate template = new ChartTemplate(typeof(ChartControl));
template.Scan(this.chartControl1);
template.Save(stream);
foreach (ChartSeries series in this.chartControl1.Series)
{
template.ScanSeries(series);
template.SaveSeries(stream);
}
byte[] buffer = new byte[stream.Length - 1 + 1];
stream.Position = 0;
stream.Read(buffer, 0, System.Convert.ToInt32(stream.Length));
stream.Dispose();
stream.Close();
File.WriteAllBytes(saveTemplateFile, buffer);
|
ChartDataBindAxisLabelModel dataLabelsModel = new ChartDataBindAxisLabelModel(dgv.DataSource, "Column1");
dataLabelsModel.LabelName = "Column1";
It does not set the labels with the text entries in Column1 but instead simply leaves them 0, 1, 2, 3, etc.
IS the ChartFormatAxisEvent simply not read for serializing? If the datalabelsmodel method does allow serializing, do you have any ideas why that method is not woring?
Thanks!
|
[C#]
ChartDataBindAxisLabelModel labelModel = new ChartDataBindAxisLabelModel(data);
labelModel.LabelName = "Labels";
chartControl1.Indexed = true;
chartControl1.PrimaryXAxis.LabelsImpl = labelModel;
chartControl1.PrimaryXAxis.ValueType = ChartValueType.Custom;
chartControl1.PrimaryXAxis.TickLabelsDrawingMode = ChartAxisTickLabelDrawingMode.UserMode;
|
I could probably save all of the additional properties to a hidden gridcontrol and then loop through the grid and save and apply these settings from the grid, but of course this creates a lot more work and impacts performance as it adds a lot of looping.
So, ideally, it would be wonderful is serializing the chartcontrols would capture all properties and then reloading would load the chart exactly as it was when saved.
Any updates would be very much appreciated.
Thanks!