View Full Version : [CLOSED] Problem to draw a chart into a panel

May 22, 2012, 2:23 PM

I manage to draw my code behind generated charts directly into a window, but not into a panel...See code below :

<%@ Page Language="C#" %>

<%@ Import Namespace="Ext.Net.Utilities"%>
<%@ Import Namespace="Panel=Ext.Net.Panel" %>
<%@ Import Namespace="Chart=Ext.Net.Chart" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>

<script runat="server">
protected void Page_Load(object sender,EventArgs e)
// Load the data into the Store and DataBind.
this.stoCharts.DataSource = this.stoChartsValue;

BuildWindow1().Render(this.Form); //construct window with chart build into
BuildWindow2().Render(this.Form); //construct window with chart into a panel in the window

private object[] stoChartsValue
return new object[]
new object[] {"2011/01/01",10},
new object[] {"2011/02/01",15},
new object[] {"2011/03/01",21},
new object[] {"2011/04/01",1},
new object[] {"2011/05/01",18},
new object[] {"2011/06/01",30},
new object[] {"2011/07/01",25},
new object[] {"2011/08/01",14},
new object[] {"2011/09/01",11},
new object[] {"2011/10/01",9},
new object[] {"2011/11/01",3},
new object[] {"2011/12/01",45}

private Window BuildWindow1()
return this.X().Window()
.Title("My Window With Chart in it")


private Window BuildWindow2()
return this.X().Window()
.Title("My Window with chart into panel")

private Chart BuildChart()
Chart MyChart = new Chart();
AxisCollection MyAxes=new AxisCollection();
CategoryAxis AxesX =new CategoryAxis();
NumericAxis AxesY= new NumericAxis();
LineSeries MySerie=new LineSeries();

AxesX.Title = "Month";
AxesX.Fields = new string[1];
AxesX.Fields[0] = "Date";

AxesY.Minimum = 0;
AxesY.Fields = new string[1];
AxesY.Fields[0] = "Value";


MySerie.SeriesID = "IdSerie";
MySerie.Axis = Position.Left;
MySerie.XField = new string[1];
MySerie.XField[0] = "Date";
MySerie.YField = new string[1];
MySerie.YField[0] = "Value";
MySerie.Title = "Test";

MySerie.MarkerConfig = new SpriteAttributes();
MySerie.MarkerConfig.Fill = "#00ff00";
MySerie.MarkerConfig.Stroke = "#00ff00";
MySerie.MarkerConfig.Type = SpriteType.Circle;
MySerie.MarkerConfig.Size = 3;
MySerie.MarkerConfig.Radius = 3;

MySerie.Style = new SpriteAttributes();
MySerie.Style.Fill = "#00ff00";
MySerie.Style.Stroke = "#00ff00";
MySerie.Style.StrokeWidth = 0;

MyChart.StoreID = "stoCharts";
MyChart.Animate = true;

MyChart.Legend = true;

return MyChart;

private Panel BuildPanel()
return this.X().Panel()


<!DOCTYPE html protected "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>Test Chart into panel</title>

<ext:ResourcePlaceHolder ID="ResourcePlaceHolder1" runat="server" Mode="ScriptFiles" />


<form id="form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" RethrowAjaxExceptions="True">

<%-- Data stores--%>
<ext:Store ID="stoCharts" runat="server" AutoLoad="True">
<ext:ArrayReader />
<ext:Model ID="Model2" runat="server">
<ext:ModelField Name="Date" />
<ext:ModelField Name="Value" />



Side effect, my serie is not drawn into the window, didn't know why, in VB code it works see :


Meanwhile, we can see the X axis anyway and it is not the point. The point is why I cannot manage to deal with the panel?

May 22, 2012, 3:50 PM

Please add

for the Panel as well.

May 22, 2012, 4:01 PM
Your right it works. thanks

May 23, 2012, 7:57 AM

Please could you explain why series is not shown? I think I have found a bug in vertical axis when several series are drawn but to show it I need to draw the series.

Whne I will be able to show it, I will make a new thread.

May 23, 2012, 11:18 AM
Do you mean this LineSeries?

LineSeries MySerie = new LineSeries();

Well, I can't see where you add it to the Chart. So, please add:


Also I would recommend to replace


as the Render method is designed to be used during an ajax request.

May 23, 2012, 12:01 PM
Damn it! You'r right...Works better if serie is added to chart...OK, I construct my example and report in a new thread if behavior is the same that the one I experiment with VB.