Jump to content

 

Photo

Data table on chart?


  • Please log in to reply
11 replies to this topic

#1 Daniel H

Daniel H

    Member

  • Members
  • PipPip
  • 14 posts

Posted 10 December 2009 - 06:19 AM

One of my users requires a table that shows the data values being represented on the chart, similar to what Excel can produce (see example attached). The user needs the table data to display directly under the corresponding Axis Label, as shown in the picture. I am able to put the data in the Axis Label, but I haven't formatted it as a table yet. Any ideas on how to do this?

Thanks!
~~Daniel

Attached Files



#2 somnath

somnath

    Advanced Member

  • Team Visifire
  • PipPipPip
  • 959 posts
  • Gender:Male
  • Location:Bangalore

Posted 10 December 2009 - 12:38 PM

Hi Daniel,

Can you please tell me whether you are working with JavaScript or Silverlight managed code?

Regards,
Somnath

#3 Daniel H

Daniel H

    Member

  • Members
  • PipPip
  • 14 posts

Posted 11 December 2009 - 04:25 AM

Hi Daniel,

Can you please tell me whether you are working with JavaScript or Silverlight managed code?

Regards,
Somnath


Hi Somnath,

I'm using Javascript. I have attached a .html that renders the graph portion wonderfully. Any suggestions for ways to put the data chart below the graph, but still in the Silverlight object, would be wonderful!

My current idea is to use a <Legend>, but I think that I would have to simulate the graph's spacing with blank spaces in the legend.

Many thanks,
~~Daniel

Attached Files



#4 somnath

somnath

    Advanced Member

  • Team Visifire
  • PipPipPip
  • 959 posts
  • Gender:Male
  • Location:Bangalore

Posted 11 December 2009 - 06:10 AM

Hi Daniel,

You can display the data-table just below the chart. The width of the y-axis and width of the x-axis will be available soon after the chart is rendered. You can use the Rendered event of the chart. So it will be easy to create a table and position it just below the chart. Please note that if you want the table to be shown inside Silverlight content you have to write your own Silverlight application using Visifire chart. You can use Visifire to display the chart and draw the table inside Silverlight. Also you can achieve the same using JavaScript by placing a HTML table element under the Visifire chart.

Regards,
Somnath

#5 Daniel H

Daniel H

    Member

  • Members
  • PipPip
  • 14 posts

Posted 12 December 2009 - 07:41 AM

Hi Somnath,

I had already drawn the data-table below the chart with a very nicely-formatted HTML table, but the user wasn't enthralled. He wants it just under the DataPoint labels on the X-axis of the graph.

... Please note that if you want the table to be shown inside Silverlight content you have to write your own Silverlight application using Visifire chart. You can use Visifire to display the chart and draw the table inside Silverlight. Also you can achieve the same using JavaScript by placing a HTML table element under the Visifire chart.

Regards,
Somnath


I think you are on the right track here! I have never written my own Silverlight application using Visifire, but I would try. Can you recommend any pages to point me in the right direction? I am more familiar with JavaScript, so if I can stay in it, it will be easier for me.

Many thanks,
~~Daniel

#6 somnath

somnath

    Advanced Member

  • Team Visifire
  • PipPipPip
  • 959 posts
  • Gender:Male
  • Location:Bangalore

Posted 12 December 2009 - 12:47 PM

Hi Daniel,

The following links will be helpful for if you want to learn about Silverlight application.
http://silverlight.net/getstarted/
http://visifire.com/...ight_Sample.htm

Regards,
Somnath

#7 Daniel H

Daniel H

    Member

  • Members
  • PipPip
  • 14 posts

Posted 15 December 2009 - 11:31 AM

Hi Daniel,

You can display the data-table just below the chart. The width of the y-axis and width of the x-axis will be available soon after the chart is rendered. You can use the Rendered event of the chart. So it will be easy to create a table and position it just below the chart. Please note that if you want the table to be shown inside Silverlight content you have to write your own Silverlight application using Visifire chart. You can use Visifire to display the chart and draw the table inside Silverlight. Also you can achieve the same using JavaScript by placing a HTML table element under the Visifire chart.

Regards,
Somnath


Hi Somnath,

So far, so good. I have been able to display the table below the chart inside Silverlight (managed code), but the table is not yet in the right position. You mentioned that I can use the Rendered event of the chart to find the width of the y-axis, but I haven't figured out how to do this yet. Can you help again please? Thanks!

#8 vivek

vivek

    Advanced Member

  • Team Visifire
  • PipPipPip
  • 3,587 posts
  • Gender:Male
  • Location:Bangalore

Posted 15 December 2009 - 12:20 PM

Daniel,

You can attach Rendered event to Chart as shown below:

chart.Rendered += new EventHandler(chart_Rendered);

Then inside the event handler, you can get the Width of the Axis as shown below:

void chart_Rendered(object sender, EventArgs e)
{
     Double width = chart.AxesY[0].Width;
}

Regards,
Vivek
Team Visifire


#9 Daniel H

Daniel H

    Member

  • Members
  • PipPip
  • 14 posts

Posted 17 December 2009 - 06:27 AM

Vivek,

I have added the event handler, but the Width property doesn't seem to show the actual width on the application, which is what I'm trying to calculate. I changed the function to the following line for debugging:

MessageBox.Show("Debug:Width=" + chart.AxesY[0].Width.ToString());

I noticed that this messagebox always appears just before the chart is displayed, but I expected it immediately after. Also, this property seems to display "NaN" (not a number) unless I explicitly state the width of the axis during creation of the chart:
            chart = new Chart();
            chart.Rendered += new EventHandler(Chart_Rendered);
            Axis newAxis = new Axis();
            newAxis.Width = 1000;
            chart.AxesY.Add(newAxis);

With the above code, the MessageBox displays "1000", even though the axis is obviously not that wide when it is displayed. I noticed that there is also an "ActualWidth" property exposed, and I attempted to display that property with similar results, except that ActualWidth=0 when I do not assign the axis a width.

What am I doing incorrectly?

#10 somnath

somnath

    Advanced Member

  • Team Visifire
  • PipPipPip
  • 959 posts
  • Gender:Male
  • Location:Bangalore

Posted 17 December 2009 - 10:08 AM

Hi Daniel,

You will be able to receive exact width of y-axis once the chart is rendered. We have tested it here. Itís working fine. So, I request you to download the latest version of Visifire from here and try.

Regards,
Somnath

#11 GannonE75

GannonE75

    Newbie

  • Members
  • Pip
  • 3 posts

Posted 13 February 2012 - 04:19 AM

Now has a better way to solve this problem? display the chart and draw the table inside Silverlight like Excel chart ?
Such as :
http://office.microsoft.com/en-us/excel-help/show-or-hide-a-chart-legend-or-data-table-HP010007432.aspx

#12 vivek

vivek

    Advanced Member

  • Team Visifire
  • PipPipPip
  • 3,587 posts
  • Gender:Male
  • Location:Bangalore

Posted 14 February 2012 - 12:36 PM

Gannon,

Currently there is no direct way to add a data table in chart. But you can make use of CustomAxisLabels to achieve something similar.

Regards,
Vivek
Team Visifire





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users