Jump to content
Software FX Community

Dataset XML


User (Legacy)

Recommended Posts

I have a dataset  XML  (dataset stored in xml format) stored in the database

and for the archiving purpose I want to go directly to stored xml data and

render chart from their instead of going to source database (faster speed

and less space for summarized data)

the problem i have is following:

i read the xml data and convert back to dataset and attach dataset to chart

and datagrid. Datagrid shows the data however chart does not show data.

Please find xml (which i got it from dataset and stored as an xml) that i

converting back to dataset

<NewDataSet><ConfigData><YEAR>2006</YEAR><COUNT>54088</COUNT></ConfigData><C

onfigData><YEAR>2007</YEAR><COUNT>8344</COUNT></ConfigData></NewDataSet>

Is there a something i need to do on converted dataset to be compatible for

Chart? I am using Charfx 2005.

Best Regards,

Dharmesh Trivedi

Link to comment
Share on other sites

You can pass the DataSet object instead of the file.

The Chart FX Data XML format looks like this:

<?xml version="1.0"?><CHARTFX> <COLUMNS> <COLUMN NAME="Product"

TYPE="String"/> <COLUMN NAME="Q1" TYPE="Integer" DESCRIPTION="1ST QTR"/>

<COLUMN NAME="Q2" TYPE="Integer"/> <COLUMN NAME="Q3" TYPE="Integer"/>

<COLUMN NAME="Q4" TYPE="Integer"/> </COLUMNS> <ROW Product="ChartFX 98"

Q1="9200" Q2="7835" Q3="10245" Q4="8762"/> <ROW Product="ChartFX IE 3.5"

Q1="14350" Q2="11233" Q3="16754" Q4="987"/> <ROW Product="ReportFX"

Q1="12398" Q2="7654" Q3="5678" Q4="9087"/> <ROW Product="Image Toppings"

Q1="8742" Q2="12358" Q3="14321" Q4="8702"/></CHARTFX> For more information

please refer to the programmer´s guide.

--

Francisco Padron

www.chartfx.com

Link to comment
Share on other sites

Francisco,

I am converting xml to dataset and that dataset attached to datagrid fine

howerver chart shows no data found message.

Best Regards,

Dharmesh Trivedi

"Software FX" <noreply@softwarefx.com> wrote in message

news:6xLtGVIUHHA.1212@webserver3.softwarefx.com...

> You can pass the DataSet object instead of the file.

>

> The Chart FX Data XML format looks like this:

>

> <?xml version="1.0"?><CHARTFX> <COLUMNS> <COLUMN NAME="Product"

> TYPE="String"/> <COLUMN NAME="Q1" TYPE="Integer" DESCRIPTION="1ST

QTR"/>

> <COLUMN NAME="Q2" TYPE="Integer"/> <COLUMN NAME="Q3"

TYPE="Integer"/>

> <COLUMN NAME="Q4" TYPE="Integer"/> </COLUMNS> <ROW Product="ChartFX

98"

> Q1="9200" Q2="7835" Q3="10245" Q4="8762"/> <ROW Product="ChartFX IE

3.5"

> Q1="14350" Q2="11233" Q3="16754" Q4="987"/> <ROW Product="ReportFX"

> Q1="12398" Q2="7654" Q3="5678" Q4="9087"/> <ROW Product="Image Toppings"

> Q1="8742" Q2="12358" Q3="14321" Q4="8702"/></CHARTFX> For more

information

> please refer to the programmer´s guide.

> --

> Francisco Padron

> www.chartfx.com

>

Link to comment
Share on other sites

Please find it below

DataSet xmlDS = new DataSet();

StringReader stream = null;

XmlTextReader reader = null;

string

strXML="<NewDataSet><ConfigData><YEAR>2006</YEAR><COUNT>54088</COUNT></Confi

gData><C

onfigData><YEAR>2007</YEAR><COUNT>8344</COUNT></ConfigData></NewDataSet>"

stream = new StringReader(strXML);

reader = new XmlTextReader(stream);

xmlDS.ReadXml(reader);

if (xmlDS != null)

return xmlDS;

else

return null;

"Software FX" <noreply@softwarefx.com> wrote in message

news:Myef46QUHHA.1212@webserver3.softwarefx.com...

> Can you please attach a sample project that reproduces the problem.

>

> --

> Francisco Padron

> www.chartfx.com

Link to comment
Share on other sites

  • 2 weeks later...

Problem that I am having that dataset generated from XML attach to Datagrid fine however ChartFX does not show data.

Please find the code below.
I see data in datagrid however chart show "no data available" .. Please
help.
Best Regards,
Dharmesh Trivedi

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Text;
using System.Web.UI.HtmlControls;
using System.Collections;
using System.ComponentModel;
using System.Diagnostics;
using System.Web.Services;
using System.Xml;
using System.IO;

public partial class _Default : System.Web.UI.Page
{
  private wsPortalReportConfigDB.BIO.graphService wsObj = new
wsPortalReportConfigDB.BIO.graphService();

  protected void Page_Load(object sender, EventArgs e)
  {


  DataSet xmlDS = new DataSet();
  StringReader stream = null;
  XmlTextReader reader = null;
  stream = new
StringReader("<NewDataSet><ConfigData><YEAR>2006</YEAR><COUNT>54088</COUNT><
/ConfigData><ConfigData><YEAR>2007</YEAR><COUNT>8344</COUNT></ConfigData></N
ewDataSet>");
  reader = new XmlTextReader(stream);
  xmlDS.ReadXml(reader);
GridView1.DataSource = xmlDS;
GridView1.DataBind();
  Chart1.DataSource = xmlDS;
  Chart1.DataBind();



  }

"Software FX" <noreply@softwarefx.com> wrote in message
news:fPf#POgUHHA.620@webserver3.softwarefx.com...
> And then you are doing what with xmlDS ?
>
> I tried assigning it to a DataGridView's DataSource but got nothing.
>
> You said:
> > I am converting xml to dataset and that dataset attached to datagrid
fine
>
> Where is that code ?
>
> --
> Francisco Padron
> www.chartfx.com

Link to comment
Share on other sites

The problem is both COUNT and YEAR are STRING columns . That is the type in the DataSet. The grid is showing them as strings, you can tell by the alignment. Obviously the chart needs numbers to plot, since it didn't find any it displays an empty plot.

 You can do:

1) Setup your dataset columns so that they are the appropriate type. For this you need to read the schema:

xmlDS.ReadXmlSchema(schemaReader);

2) Tell Chart FX to convert these strings to numbers:

Chart1.DataSourceSettings.Fields.Add(new ChartFX.WebForms.FieldMap("YEAR",ChartFX.WebForms.FieldUsage.Value));

Chart1.DataSourceSettings.Fields.Add(new ChartFX.WebForms.FieldMap("COUNT",ChartFX.WebForms.FieldUsage.Value));

Note: Chart FX will fail if the contents of the data are not numbers

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...