Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8000799
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T15:54:41+00:00 2026-06-04T15:54:41+00:00

I have to make a graph based on a list of items. For this

  • 0

I have to make a graph based on a list of items.
For this I use dataview chart and ASP. Net.

The problem is that my graph is empty but I have data.

The data:

xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <Expense>
  <Type>Achat pièce</Type> 
  <Total>173.50</Total> 
  </Expense>
  </Root>

The code use to build the char:

DataSet dataSet = new DataSet();
DataTable dataTable = new DataTable("Table");
dataTable.Columns.Add("Total", typeof(string));
dataTable.Columns.Add("Type", typeof(string));
dataSet.Tables.Add(dataTable);

//GetData & fill dataTable
            var listOfExpense = Helper.JsonHelper.FromJson<ExpensePie>(resp.Content);
            foreach (var expense in listOfExpense.ListOfExpense)
            {
                dataTable.Rows.Add(expense.Total, expense.Type);
            }


//Fill data view with dataset
var dataView = new DataView(dataSet.Tables["Table"]);

//Build the chart
var myChart = new Chart(width: 600, height: 400, theme: ChartTheme.Blue)
   .AddSeries("Default", chartType: "bar",
   xValue:dataView, xField:"Type",
   yValues: dataView, yFields: "Total")
   .GetBytes("png");
return File(myChart, "image/png");
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T15:54:42+00:00Added an answer on June 4, 2026 at 3:54 pm

    There must be something wrong with the way you are parsing your XML. You seem to be using some custom FromJson method and some XmlDocument to fill your dataset but I guess that your dataset doesn’t contain any values because the following works perfectly fine:

    public ActionResult Index()
    {
        DataSet dataSet = new DataSet();
        DataTable dataTable = new DataTable("Table");
        dataTable.Columns.Add("Total", typeof(double));
        dataTable.Columns.Add("Type", typeof(string));
        dataSet.Tables.Add(dataTable);
    
        dataTable.Rows.Add(173.5, "Achat pièce");
        dataTable.Rows.Add(145.7, "Something else");
    
        //Fill data view with dataset
        var dataView = new DataView(dataSet.Tables["Table"]);
    
        //Build the chart
        var myChart = new Chart(width: 600, height: 400, theme: ChartTheme.Blue)
            .AddSeries("Default", chartType: "bar",
            xValue: dataView, xField: "Type",
            yValues: dataView, yFields: "Total")
            .GetBytes("png");
        return File(myChart, "image/png");
    }
    

    result:

    enter image description here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using this sample : I have make my own Fragment that holds tabhost and
My question may not make sense but I have valid reason. We use .net
I have to make a decision of which database server to use for my
I have data in data table like below. I am trying to make graph
I have a function that parses urls given to it, and based on the
I have several functions on graph f(), g() and h() that implements different algorithms
I have this jqplot bar graph. The current display of the bars are shown
Problem: I have to plot a simple 3D graph/diagram with x,y,z coordinates given for
I need to write a graph using C++ and I have a little problem.
I have a class Graph whose copy constructor is declared in Graph.h like this:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.