csvhelper everything get written in one column in Excel - c#

I'm trying to use csvhelper to create my csv file by following some tutorials but all my data get written in only one column. This is my code:
EDITED As I understood from the comments, the problem is with excel reading the csv files. I found some solution that I can fix this problem by making some changes in Excel setting, in that case my question is: is there anyway to address this issue from my code, that it won't require any changes in Excel setting to be able to read csv files properly?
public void CreateCSVFile()
{
using (var sw = new StreamWriter(#"countrylistoutput.csv"))
{
var writer = new CsvWriter(sw);
using (var dt = ExportToCSV())
{
foreach (DataColumn column in dt.Columns)
{
writer.WriteField(column.ColumnName);
}
writer.NextRecord();
foreach (DataRow row in dt.Rows)
{
for (var i = 0; i < dt.Columns.Count; i++)
{
writer.WriteField(row[i]);
}
writer.NextRecord();
}
}
}
}
I don't get what I'm doing wrong, I would appreciate it if anyone could help me with this issue.
And here is how I tried to feed the data:
public System.Data.DataTable ExportToCSV()
{
System.Data.DataTable table = new System.Data.DataTable();
table.Columns.Add("ID", typeof(int));
table.Columns.Add("Name", typeof(string));
table.Columns.Add("Sex", typeof(string));
table.Columns.Add("Subject1", typeof(int));
table.Columns.Add("Subject2", typeof(int));
table.Columns.Add("Subject3", typeof(int));
table.Columns.Add("Subject4", typeof(int));
table.Columns.Add("Subject5", typeof(int));
table.Columns.Add("Subject6", typeof(int));
table.Rows.Add(1, "Amar", "M", 78, 59, 72, 95, 83, 77);
table.Rows.Add(2, "Mohit", "M", 76, 65, 85, 87, 72, 90);
table.Rows.Add(3, "Garima", "F", 77, 73, 83, 64, 86, 63);
table.Rows.Add(4, "jyoti", "F", 55, 77, 85, 69, 70, 86);
table.Rows.Add(5, "Avinash", "M", 87, 73, 69, 75, 67, 81);
table.Rows.Add(6, "Devesh", "M", 92, 87, 78, 73, 75, 72);
return table;
}
}
screenshot of the result
Thanks

That happens when Excel doesn't use commas as the field separator (it depends on Excel's locale). The solution for Excel specifically is to add a special sep=, line at the top of the file, above any headers. For example:
using (var streamWriter = new StreamWriter(outputFilePath))
{
streamWriter.WriteLine("sep=,"); // make Excel use comma as field separator
using (var csvWriter = new CsvWriter(streamWriter))
{
csvWriter.WriteField("field A");
csvWriter.WriteField("field B");
csvWriter.NextRecord();
}
}
That will fix the problem in Excel, but cause problems in other spreadsheet apps. You can support both by making that sep=, line conditional on the intended format. Here's how that might look in a web UI:

Most probably your CSV looks like
a,b,c
d,e,f
you need to make it
"a","b","c"
"d","e","f"
https://stackoverflow.com/a/54027009/9306125

Related

Is there a way to read certain columns of every row in excel?

first of all, I am very new to C#.
I would like to select every row of my excel sheet and put it in a text doc. The problem is, that I only need certain columns(21 out of 70+).
Here is my code:
For example:
Excel:
|1 2 3 4 5
1|x y c v b
2|x y c v b
3|x y c v b
And I need every row 1 to 3 but only the data from column 2,3,5
In my text doc I want it to like like:
y c b
y c b
y c b
But atm it looks like:
y
y
y
c
c
c
b
b
b
int[] spalten = new int[] { 5, 22, 24, 27, 29, 32, 34, 37, 39, 43, 45, 48, 50, 54, 56, 59, 61, 65, 67, 71, 73 };
for (int x = 0; x <= 20; x++)
{
//loop all columns
for (int j = 4; j <= 74; j++)
{
//loop all rows
for (int i = 5; worksheet.Cells[i, 5].Value != null; i++)
{
//add the cell data to the List
if (j == spalten[x])
{
if (worksheet.Cells[i, j].Value == null)
{
Console.WriteLine("leer");
string Inhalt = "leer" + "\t";
string[] lines = { Inhalt };
File.AppendAllLines(Path.Combine(docPath, "Daten2.txt"), lines);
}
else
{
excelData.Add(worksheet.Cells[i, j].Value.ToString());
Console.WriteLine(worksheet.Cells[i, j].Value);
string Inhalt = worksheet.Cells[i, j].Value.ToString()+"\t";
string[] lines = { Inhalt };
File.AppendAllLines(Path.Combine(docPath, "Daten2.txt"), lines);
}
}
}
}
}
Change the order of your loops: loop over the rows first, then over the columns for the current row. Inside the inner loop, concatenate the column values into a single string.
For performance reasons, try to do as little work as possible inside the loop (e.g. do not access worksheet.Cells[] twice with the same indices). Use StringBuilder to concatenate strings. You can use foreach to loop over the configured columns only.
var configuredColumns = new int[] { 5, 22, 24, 27, 29, 32, 34, 37, 39, 43, 45, 48, 50, 54, 56, 59, 61, 65, 67, 71, 73 };
// loop over all data rows (ignore first 5 rows which are headers)
// stop looping if the current row has no data in column 5
var allRowTexts = new List<string>();
for (int row = 5; worksheet.Cells[row, 5].Value != null; row++) {
// loop over the configured columns
var rowText = new StringBuilder();
foreach (var col in configuredColumns) {
var cell = worksheet.Cells[row, col];
if (cell.Value == null) {
rowText.Append("leer" + "\t");
}
else {
rowText.Append(cell.Value.ToString() + "\t");
}
}
// rowText now contains all column values for the current row
allRowTexts.Add(rowText.ToString());
}
// write all rows into file
File.AppendAllLines(Path.Combine(docPath, "Daten2.txt"), allRowTexts);
C# Fiddle using dummy WorkSheet and Console output

How to save an excel file in C#

I'm creating an MVC controller action where JSON data passed in to the method is to be written to an excel file. Right now, I'm testing out the functionality by using hardcoded data from a data table based on the example from this blog post.
Here is the code I have:
[HttpPost]
public ActionResult ExportData()
{
Microsoft.Office.Interop.Excel.Application excel;
Microsoft.Office.Interop.Excel.Workbook worKbooK;
Microsoft.Office.Interop.Excel.Worksheet worKsheeT;
Microsoft.Office.Interop.Excel.Range celLrangE;
try
{
excel = new Microsoft.Office.Interop.Excel.Application();
excel.Visible = false;
excel.DisplayAlerts = false;
worKbooK = excel.Workbooks.Add(Type.Missing);
worKsheeT = (Microsoft.Office.Interop.Excel.Worksheet)worKbooK.ActiveSheet;
worKsheeT.Name = "StudentRepoertCard";
worKsheeT.Range[worKsheeT.Cells[1, 1], worKsheeT.Cells[1, 8]].Merge();
worKsheeT.Cells[1, 1] = "Student Report Card";
worKsheeT.Cells.Font.Size = 15;
int rowcount = 2;
foreach (DataRow datarow in ExportToExcel().Rows)
{
rowcount += 1;
for (int i = 1; i <= ExportToExcel().Columns.Count; i++)
{
if (rowcount == 3)
{
worKsheeT.Cells[2, i] = ExportToExcel().Columns[i - 1].ColumnName;
worKsheeT.Cells.Font.Color = System.Drawing.Color.Black;
}
worKsheeT.Cells[rowcount, i] = datarow[i - 1].ToString();
if (rowcount > 3)
{
if (i == ExportToExcel().Columns.Count)
{
if (rowcount % 2 == 0)
{
celLrangE = worKsheeT.Range[worKsheeT.Cells[rowcount, 1], worKsheeT.Cells[rowcount, ExportToExcel().Columns.Count]];
}
}
}
}
}
celLrangE = worKsheeT.Range[worKsheeT.Cells[1, 1], worKsheeT.Cells[rowcount, ExportToExcel().Columns.Count]];
celLrangE.EntireColumn.AutoFit();
Microsoft.Office.Interop.Excel.Borders border = celLrangE.Borders;
border.LineStyle = Microsoft.Office.Interop.Excel.XlLineStyle.xlContinuous;
border.Weight = 2d;
celLrangE = worKsheeT.Range[worKsheeT.Cells[1, 1], worKsheeT.Cells[2, ExportToExcel().Columns.Count]];
worKbooK.SaveAs("\\root\\test.xlsx");
worKbooK.Close();
excel.Quit();
}
catch (Exception ex)
{
return Json(new { saveSuccess = false }, JsonRequestBehavior.AllowGet);
}
finally
{
worKsheeT = null;
celLrangE = null;
worKbooK = null;
}
return Json(new { saveSuccess = true }, JsonRequestBehavior.AllowGet);
}
//private void Form1_Load(object sender, EventArgs e)
//{
// dataGridView1.DataSource = ExportToExcel();
//}
public System.Data.DataTable ExportToExcel()
{
System.Data.DataTable table = new System.Data.DataTable();
table.Columns.Add("ID", typeof(int));
table.Columns.Add("Name", typeof(string));
table.Columns.Add("Sex", typeof(string));
table.Columns.Add("Subject1", typeof(int));
table.Columns.Add("Subject2", typeof(int));
table.Columns.Add("Subject3", typeof(int));
table.Columns.Add("Subject4", typeof(int));
table.Columns.Add("Subject5", typeof(int));
table.Columns.Add("Subject6", typeof(int));
table.Rows.Add(1, "Amar", "M", 78, 59, 72, 95, 83, 77);
table.Rows.Add(2, "Mohit", "M", 76, 65, 85, 87, 72, 90);
table.Rows.Add(3, "Garima", "F", 77, 73, 83, 64, 86, 63);
table.Rows.Add(4, "jyoti", "F", 55, 77, 85, 69, 70, 86);
table.Rows.Add(5, "Avinash", "M", 87, 73, 69, 75, 67, 81);
table.Rows.Add(6, "Devesh", "M", 92, 87, 78, 73, 75, 72);
return table;
}
Right now, the code works up until the point where the save happens. For some reason, the file location is not found. I was assuming that the name of the file had to be listed at the end of the path after the containing folder in order to provide the name, but maybe this isn't the correct way to specify the file path.
What I actually need to do is to allow the user to choose the file location in file explorer, provide a name, and then save the file. Since this is the case, the file path would have to be provided dynamically. I've looked at many SO posts and articles but I haven't seen a clear example of how to do this.
How should the code be modified for the user to be able to specify the file name and path?
You cannot choose to save the file from their browser. You need to serve up the file and let them download it and save it where they like.
Also, the server you want a production ASP.NET application deployed to probably doesn't have a copy of Excel installed (and even if it does interop gets a little messy IMHO) so you probably want to use a openXml library such as EPPlus instead.
This would let you do something like this:
public IActionResult ExportData()
{
using (var excel = new ExcelPackage())
{
var wks = excel.Workbook.Worksheets.Add("StudentReportCard");
wks.Cells[1,1].LoadFromCollection(GetStudentRecords(), PrintHeaders:true);
return File(excel.GetAsByteArray(),"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "export.xlsx");
};
}
private static IEnumerable<StudentRecord> GetStudentRecords()
{
yield return new StudentRecord
{
Id = 1,
Name = "John",
Subject = "Maths",
Score = 77.9
};
yield return new StudentRecord
{
Id = 2,
Name = "Jane",
Subject = "Maths",
Score = 78.9
};
yield return new StudentRecord
{
Id = 3,
Name = "Jo",
Subject = "Maths",
Score = 99.9
};
}
Which sends a file like this named 'export.xlsx' for the user to save from their browser:

How to decode a string encoded by C# Convert.ToBase64String in python 3

The c# server side:
[HttpGet("{id}")]
public ActionResult Get(int id)
{
var user = new User
{
Id = id,
Name = $"User{id}"
};
using(var ms = new MemoryStream())
{
ProtoBuf.Serializer.Serialize(ms, user);
var bytes = ms.ToArray();
var str = Convert.ToBase64String(bytes);
return Json(str);
}
}
the python client side:
async def foo():
async with ClientSession() as session:
async with session.get("http://localhost:57968/api/values/5") as response:
json = await response.json()
# how to get the bytes created by the server
person = Person.create_from_bytes(bs)
How to get the raw bytes array created by the server using ProtoBuf.Serializer.Serialize(ms, user); in the python client.
If i do not wrap the raw byte array with base64:
Update: I worked it out in the python client side like this:
json = await response.json()
bs = json.encode("ascii")
b64 = base64.b64decode(bs)
person = Person.create_from_bytes(b64)
print(f"{person.id} {person.name}")
Finally, i worked it out in the client side by using:
json = await response.json()
bs = json.encode("ascii")
b64 = base64.b64decode(bs)
person = Person.create_from_bytes(b64)
print(f"{person.id} {person.name}")
I had some time to develop this Solution for Python3.7, considering as example:
''' Argument = [110, 13, 46, 136, 95, 66, 92, 132, 109, 217, 58, 112, 43, 8, 145,
42, 233, 98, 40, 139, 165, 228, 52, 9, 89, 175, 146, 103, 227, 238, 233, 190,
78, 175, 242, 224, 202, 138, 248, 103, 114, 98, 199, 252, 80, 86, 61, 174]
return = 'bg0uiF9CXIRt2TpwKwiRKuliKIul5DQJWa+SZ+Pu6b5Or/Lgyor4Z3Jix/xQVj2u'
'''
Like this:
import base64
import numpy as np
# Do the same as Convert.ToBase64String() from C#
def ConvertToBase64String(encrypted):
return (base64.b64encode(textoUnicodeToUtf8Literal(("".join([chr(item) for item in np.array(encrypted, dtype=np.uint8)]))).encode('ISO-8859-1'))).decode()
# Do the oposite of Convert.ToBase64String() from C#
def ConvertToStringBase64(encrypted):
return np.frombuffer(base64.b64decode(encrypted.encode()), np.uint8)
def textoUnicodeToUtf8Literal(encodando):
return encodando.replace("\xc2\x80", r'\x80').replace("\xc2\x81", r'\x81').replace("\xc2\x82", r'\x82')\
.replace("\xc2\x83", r'\x83').replace("\xc2\x84", r'\x84').replace("\xc2\x85", r'\x85')\
.replace("\xc2\x86", r'\x86').replace("\xc2\x87", r'\x87').replace("\xc2\x88", r'\x88')\
.replace("\xc2\x89", r'\x89').replace("\xc2\x8a", r'\x8A').replace("\xc2\x8b", r'\x8B')\
.replace("\xc2\x8c", r'\x8C').replace("\xc2\x8d", r'\x8D').replace("\xc2\x8e", r'\x8E')\
.replace("\xc2\x8f", r'\x8F').replace("\xc2\x90", r'\x90').replace("\xc2\x91", r'\x91')\
.replace("\xc2\x92", r'\x92').replace("\xc2\x93", r'\x93').replace("\xc2\x94", r'\x94')\
.replace("\xc2\x95", r'\x95').replace("\xc2\x96", r'\x96').replace("\xc2\x97", r'\x97')\
.replace("\xc2\x98", r'\x98').replace("\xc2\x99", r'\x99').replace("\xc2\x9a", r'\x9A')\
.replace("\xc2\x9b", r'\x9B').replace("\xc2\x9c", r'\x9C').replace("\xc2\x9d", r'\x9D')\
.replace("\xc2\x9e", r'\x9E').replace("\xc2\x9f", r'\x9F').replace("\xc2\xa0", r'\xA0')\
.replace("\xc2\xa1", r'\xA1').replace("\xc2\xa2", r'\xA2').replace("\xc2\xa3", r'\xA3')\
.replace("\xc2\xa4", r'\xA4').replace("\xc2\xa5", r'\xA5').replace("\xc2\xa6", r'\xA6')\
.replace("\xc2\xa7", r'\xA7').replace("\xc2\xa8", r'\xA8').replace("\xc2\xa9", r'\xA9')\
.replace("\xc2\xaa", r'\xAA').replace("\xc2\xab", r'\xAB').replace("\xc2\xac", r'\xAC')\
.replace("\xc2\xad", r'\xAD').replace("\xc2\xae", r'\xAE').replace("\xc2\xaf", r'\xAF')\
.replace("\xc2\xb0", r'\xB0').replace("\xc2\xb1", r'\xB1').replace("\xc2\xb2", r'\xB2')\
.replace("\xc2\xb3", r'\xB3').replace("\xc2\xb4", r'\xB4').replace("\xc2\xb5", r'\xB5')\
.replace("\xc2\xb6", r'\xB6').replace("\xc2\xb7", r'\xB7').replace("\xc2\xb8", r'\xB8')\
.replace("\xc2\xb9", r'\xB9').replace("\xc2\xba", r'\xBA').replace("\xc2\xbb", r'\xBB')\
.replace("\xc2\xbc", r'\xBC').replace("\xc2\xbd", r'\xBD').replace("\xc2\xbe", r'\xBE')\
.replace("\xc2\xbf", r'\xBF').replace("\xc3\x80", r'\xC0').replace("\xc3\x81", r'\xC1')\
.replace("\xc3\x82", r'\xC2').replace("\xc3\x83", r'\xC3').replace("\xc3\x84", r'\xC4')\
.replace("\xc3\x85", r'\xC5').replace("\xc3\x86", r'\xC6').replace("\xc3\x87", r'\xC7')\
.replace("\xc3\x88", r'\xC8').replace("\xc3\x89", r'\xC9').replace("\xc3\x8a", r'\xCA')\
.replace("\xc3\x8b", r'\xCB').replace("\xc3\x8c", r'\xCC').replace("\xc3\x8d", r'\xCD')\
.replace("\xc3\x8e", r'\xCE').replace("\xc3\x8f", r'\xCF').replace("\xc3\x90", r'\xD0')\
.replace("\xc3\x91", r'\xD1').replace("\xc3\x92", r'\xD2').replace("\xc3\x93", r'\xD3')\
.replace("\xc3\x94", r'\xD4').replace("\xc3\x95", r'\xD5').replace("\xc3\x96", r'\xD6')\
.replace("\xc3\x97", r'\xD7').replace("\xc3\x98", r'\xD8').replace("\xc3\x99", r'\xD9')\
.replace("\xc3\x9a", r'\xDA').replace("\xc3\x9b", r'\xDB').replace("\xc3\x9c", r'\xDC')\
.replace("\xc3\x9d", r'\xDD').replace("\xc3\x9e", r'\xDE').replace("\xc3\x9f", r'\xDF')\
.replace("\xc3\xa0", r'\xE0').replace("\xc3\xa1", r'\xE1').replace("\xc3\xa2", r'\xE2')\
.replace("\xc3\xa3", r'\xE3').replace("\xc3\xa4", r'\xE4').replace("\xc3\xa5", r'\xE5')\
.replace("\xc3\xa6", r'\xE6').replace("\xc3\xa7", r'\xE7').replace("\xc3\xa8", r'\xE8')\
.replace("\xc3\xa9", r'\xE9').replace("\xc3\xaa", r'\xEA').replace("\xc3\xab", r'\xEB')\
.replace("\xc3\xac", r'\xEC').replace("\xc3\xad", r'\xED').replace("\xc3\xae", r'\xEE')\
.replace("\xc3\xaf", r'\xEF').replace("\xc3\xb0", r'\xF0').replace("\xc3\xb1", r'\xF1')\
.replace("\xc3\xb2", r'\xF2').replace("\xc3\xb3", r'\xF3').replace("\xc3\xb4", r'\xF4')\
.replace("\xc3\xb5", r'\xF5').replace("\xc3\xb6", r'\xF6').replace("\xc3\xb7", r'\xF7')\
.replace("\xc3\xb8", r'\xF8').replace("\xc3\xb9", r'\xF9').replace("\xc3\xba", r'\xFA')\
.replace("\xc3\xbb", r'\xFB').replace("\xc3\xbc", r'\xFC').replace("\xc3\xbd", r'\xFD')\
.replace("\xc3\xbe", r'\xFE').replace("\xc3\xbf", r'\xFF')

TypeScript array equivalent in C# [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I have this array in TypeScript:
public lineChartData:Array<any> = [
{data: [65, 59, 80, 81, 56, 55, 40], label: 'Series A'},
{data: [28, 48, 40, 19, 86, 27, 90], label: 'Series B'},
{data: [18, 48, 77, 9, 100, 27, 40], label: 'Series C'}
];
How would I go about creating the equivalent in C#? I'm new to TypeScript and have never come across the 'any' type.
With anonymous types you could have
var lineChartData = new [] {
new { data = new [] { 65, 59, 80, 81, 56, 55, 40 }, label = "Series A" },
new { data = new [] { 65, 59, 80, 81, 56, 55, 40 }, label = "Series B" }
};
That looks quite close to the Typescript version presented in the question.
It'll be something like this in C#:
var lineChartData = new List<DataLine>
{
new DataLine {Data = new[] {65, 59, 80, 81, 56, 55, 40}, Label = "Series A"},
new DataLine {Data = new[] {28, 48, 40, 19, 86, 27, 90}, Label = "Series B"},
new DataLine {Data = new[] {18, 48, 77, 9, 100, 27, 40}, Label = "Series C"}
};
And every line of your LineChartData will be something like this:
class DataLine
{
public int[] Data { get; set; }
public string Label { get; set; }
}

multiple series in column chart asp.net 4.0

I am trying to create a StackedColumn chart in my asp.net application. So I have a datatable like this -
DataTable dtTemp = new DataTable();
dtTemp.Columns.Add("Phase", typeof(string));
dtTemp.Columns.Add("Status", typeof(string));
dtTemp.Columns.Add("Count", typeof(int));
dtTemp.Rows.Add("Initiate", "Pending", 10
dtTemp.Rows.Add("Initiate", "OnHold", 20);
dtTemp.Rows.Add("Initiate", "Rejected", 3);
dtTemp.Rows.Add("Initiate", "Cancelled", 5);
dtTemp.Rows.Add("Initiate", "Pending IT", 2);
dtTemp.Rows.Add("Setup", "Setup", 25);
Now I want the chart to display 2 column, first column will show the Initiate phase data with different status data. And 2nd column will show setup phase data. I have tried like this -
foreach (DataRow row in dtTemp.Rows)
{
string seriesName = row["Status"].ToString();
chart_ProjectStatus.Series.Add(seriesName);
chart_ProjectStatus.Series[seriesName].ChartType = SeriesChartType.StackedColumn;
chart_ProjectStatus.Series[seriesName].ChartArea = "ChartArea1";
chart_ProjectStatus.Series[seriesName].CustomProperties = "DrawingStyle=Cylinder, MaxPixelPointWidth=50";
chart_ProjectStatus.Series[seriesName].Points.AddXY(row["Phase"].ToString(), Convert.ToInt32(row["Count"].ToString()));
}
But I am getting only one column -
Please some one help me.
Thanks in advance
Gulrej
<b> Hope this will Help you </b>
DataTable dtTemp = new DataTable();
dtTemp.Columns.Add("Phase", typeof(string));
dtTemp.Columns.Add("Status", typeof(string));
dtTemp.Columns.Add("Count", typeof(int));
dtTemp.Columns.Add("StackGroupName", typeof(string));
dtTemp.Rows.Add("Initiate", "Pending", 10, "Group1");
dtTemp.Rows.Add("Initiate", "OnHold", 20, "Group1");
dtTemp.Rows.Add("Initiate", "Rejected", 3, "Group1");
dtTemp.Rows.Add("Initiate", "Cancelled", 5, "Group1");
dtTemp.Rows.Add("Initiate", "PendingIT", 2, "Group1");
dtTemp.Rows.Add("Setup", "Setup", 25, "Group2");
dtTemp.Rows.Add("Setup", "INSTALLED", 55, "Group2");
dtTemp.AcceptChanges();
Series ss;
for (int i = 0; i < dtTemp.Rows.Count; i++)
{
ss = new Series();
ss.Name = dtTemp.Rows[i][1].ToString();
ss.ChartType = SeriesChartType.StackedColumn;
ss["StackedGroupName"] = dtTemp.Rows[i]["StackGroupName"].ToString();
ss["DrawingStyle"] = "Cylinder";
ss.Points.AddXY(Convert.ToString(dtTemp.Rows[i]["Phase"]), Convert.ToInt32(dtTemp.Rows[i]["Count"]));
ss.IsValueShownAsLabel = true;
ChartSideBySideStacked.Series.Add(ss);
}
ChartArea chartAread = new ChartArea();
chartAread.Area3DStyle.Enable3D = true;
chartAread.Area3DStyle.Rotation = 5;
chartAread.Area3DStyle.Inclination = 10;
chartAread.Area3DStyle.IsRightAngleAxes = false;
ChartSideBySideStacked.ChartAreas.Add(chartAread);
ChartSideBySideStacked.Legends.Add(new Legend("CHartLEgend"));
ChartSideBySideStacked.AlignDataPointsByAxisLabel(); // Chart Object Name : ChartSideBySideStacked
Enable 3D
U must Provide Stacked Group Name for Each Series
Set Rotation Angle
Set Inclination and IsRightAngleAxes
this one is working fine ... please note i am using VS 2010.. Asp.Net

Categories

Resources