string in table7.Rows[yy]["Die_ID"] in to a string array.how to solve this
string[] a = null;
if(table7.Columns.Contains(colx))
{
for (int yy=0; yy
double tval = double.Parse(table7.Rows[yy][colx].ToString());
if (tval < lower || tval > upper)
{
a[yy] = table7.Rows[yy]["Die_ID"].ToString();
//Error I want to store the string values in a string array :Object reference not set to an //instance of an object.
}
}
}

VulpesPosted Jun 1, 2014, 11:28 AM
LegendItem firstItem = new LegendItem();
Font f = new Font("Georgia", 16);
foreach(string s in list)
{
LegendCell firstCell = new LegendCell(LegendCellType.Text, "Die_ID = _" + s, ContentAlignment.BottomCenter);
firstCell.Font = f;
firstItem.Cells.Add(firstCell);
}
Farhan ShariffPosted Jun 3, 2014, 9:16 AM
VulpesPosted Jun 3, 2014, 9:13 AM
Previously, we were adding a new LegendCell object for each element of the list and it may be that you're stuck with a horizontal arrangement if you do that.
Good thinking :)
Farhan ShariffPosted Jun 3, 2014, 9:03 AM
egendItem firstItem = new LegendItem();
VulpesPosted Jun 3, 2014, 9:02 AM
I couldn't find anything in the docs for the LegendItem class, which is where I'd have expected it to be. However, the Legend class has a LegendStyle property which looks promising and I'd try setting this to LegendStyle.Column.
The Legend object to be used for this purpose is, of course, the one to whose CustomItems collection the current LegendItem is being added.
Farhan ShariffPosted Jun 3, 2014, 3:43 AM
Instead of having a new line, it just added a space.
http://imgur.com/ZjPEhhb
VulpesPosted Jun 2, 2014, 9:07 AM
Farhan ShariffPosted Jun 1, 2014, 1:28 PM
http://i.imgur.com/2lKnOGP.png
foreach(string s in list)
{
LegendCell firstCell = new LegendCell(LegendCellType.Text, "Die_ID = _" + s, ContentAlignment.BottomCenter);
firstCell.Font = f;
firstItem.Cells.Add(firstCell);
}
How to print these strings one after the other also some string is printed out of chart area I used +"\n" +"\r\n" Environment.NewLine
VulpesPosted Jun 1, 2014, 1:17 PM
firstCell.Font = f;
Looking through the docs, I can't see another way to add the font. It seems you have to set each cell individually, though we're now using the same Font object for them all rather than creating a new object for each cell.
Farhan ShariffPosted Jun 1, 2014, 12:55 PM
is there any other way to add the font
LegendItem firstItem = new LegendItem();
Font f = new Font("Georgia", 16);
foreach (string s in list)
{
LegendCell firstCell = new LegendCell(LegendCellType.Text, "Die_ID = _" + s, ContentAlignment.BottomCenter);
firstcell.Font = f;
firstItem.Cells.Add(firstCell);
}
Legend myLegend = new Legend("MainLegend");
myLegend.CustomItems.Add(firstItem);
chart1.Legends.Add(myLegend);
VulpesPosted Jun 1, 2014, 12:50 PM
I've corrected it now :)
Farhan ShariffPosted Jun 1, 2014, 12:27 PM
ContentAlignment.BottomCenter);
foreach(string s in list)
{
LegendCell firstCell = new LegendCellType.Text, "Die_ID = _" + s, ContentAlignment.BottomCenter);
/*
.Text -System.Windows.Forms.DataVisualization.Charting.LegendCellType.Text' is a 'field' but is used like a 'type'
//Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement*/'
firstcell.Font = f; //The name 'firstcell' does not exist in the current context
firstItem.Cells.Add(firstCell);
}
Farhan ShariffPosted Jun 1, 2014, 5:55 AM
I want to print this list/string array in legends (chart area), how to do that
something like
LegendItem firstItem = new LegendItem();
LegendCell firstcell = new LegendCell(LegendCellType.Text, "Die_ID = "_//print the list_foreach (int i in list) {+i.ToString() }, ContentAlignment.BottomCenter);
firstcell.Font = new Font("Georgia", 16);
VulpesPosted Jun 1, 2014, 4:39 AM
Ranjit PowarPosted Jun 1, 2014, 1:20 AM