Jump to content
Software FX Community

Custom series titles not displaying in legend box


User (Legacy)

Recommended Posts

Hello,

We have just purchased our ChartFX 2005 upgrade from 6.2 and are noticing

quite strange behaviour in some areas. Among them is the inability to

customize the series titles that appear in the legend box.

We are binding the chart to a datatable, and then setting the

chart.Series[n].Text property to our value. Once the chart is painted, the

value seems to revert back to the DataColumn name. It seems to have a lot to

do with when the DataSource property is set but it is extremely unclear and

illogical how the chart behaves.

Below is the sample code which seems to be causing the problem.

If you comment out the Form1_Load implementation, the problem will not

occur.

Does anybody have any ideas why?

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Text;

using System.Windows.Forms;

namespace WindowsApplication3

{

public partial class Form1 : Form

{

DataTable dt = new DataTable();

static int i = 0;

public Form1()

{

InitializeComponent();

dt.Columns.Add("column1", typeof(DateTime));

dt.Columns.Add("column2", typeof(int));

dt.Columns.Add("column3", typeof(int));

dt.Columns.Add("column4", typeof(int));

}

private void load()

{

fx.DataSource = null;

dt.BeginLoadData();

dt.Rows.Clear();

dt.Rows.Add(new object[] { DateTime.Now.AddMonths(-2), 100, 70,

50 });

dt.Rows.Add(new object[] { DateTime.Now.AddMonths(-1), 120, 80,

40 });

dt.Rows.Add(new object[] { DateTime.Now.AddMonths(0), 140, 111,

55 });

dt.Rows.Add(new object[] { DateTime.Now.AddMonths(1), 160, 100,

30 });

dt.EndLoadData();

fx.DataSource = dt;

fx.Series[0].Text = "Title " + i.ToString();

i++;

}

private void Form1_Load(object sender, EventArgs e)

{

this.load();

}

private void button1_Click(object sender, EventArgs e)

{

this.load();

}

}

}

ChartFX_PrintPage.zip

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...