Sep 30, 2013, 8:25 AM
[CLOSED] Getting ExtJs error on creating bar chart.
Hi,
Below is a very simple code for Bar chart that i am creating dynamically:
I am getting following javascript error in ExtJS:
JavaScript runtime error: Object doesn't support property or method 'renderer'
at this line C.label.renderer(B[r])
Not sure whats wrong / missing .
Please let me know
Below is a very simple code for Bar chart that i am creating dynamically:
List<NPVBarChartModel> result = new List<NPVBarChartModel>();
result.Add(new NPVBarChartModel() { NPVMean = 100 ScenarioName = "Test1" });
result.Add(new NPVBarChartModel() { NPVMean = 200, ScenarioName = "Test2"});
Ext.Net.Chart chtGrafico = new Ext.Net.Chart()
{
ID = "BarChart",
Animate = true,
Height = 300,
Shadow = true,
Theme = "White"
//Background = new DrawBackground(){Gradient = new Gradient(){Angle =45}}
};
Store store = new Store();
store.ID = "StoreBarSnapShot1";
var model = new Model();
model.Fields.Add(new ModelField("NPVMean", ModelFieldType.String));
model.Fields.Add(new ModelField("ScenarioName", ModelFieldType.String));
store.Model.Add(model);
store.DataSource = result;
string handlerTips = " var stringValue = Ext.util.Format.number(value, '0.0'); return stringValue;";
AxisLabel l = new AxisLabel();
l.Renderer.Handler = handlerTips;
NumericAxis numericAxis = new NumericAxis()
{
Fields = new[] { "NPVMean" },
Position = Ext.Net.Position.Bottom,
Grid = true,
Minimum = 0.00,
Label = l
};
chtGrafico.Axes.Add(numericAxis);
chtGrafico.Store.Add(store);
CategoryAxis categoryAxis = new CategoryAxis()
{
Fields = new string[] { "ScenarioName" },
Title = CategoryTitle,
Position = Position.Left
};
chtGrafico.Axes.Add(categoryAxis);
SeriesCollection absSeries = new SeriesCollection();
absSeries.Add(
Html.X().BarSeries()
.Axis(Position.Bottom)
.XField("ScenarioName")
.YField("NPVMean")
.Highlight(true)
.Label(new SeriesLabel()
{
Display = SeriesLabelDisplay.None,
Field = new[] { "NPVMean" },
Orientation = Orientation.Horizontal,
Color = "#333E",
TextAnchor = "middle"
})
);
foreach (var ser in absSeries)
{
chtGrafico.Series.Add(ser);
}
pnlGrafico.Items.Add(chtGrafico);
pnlGrafico is the container where i append my chart.I am getting following javascript error in ExtJS:
JavaScript runtime error: Object doesn't support property or method 'renderer'
at this line C.label.renderer(B[r])
Not sure whats wrong / missing .
Please let me know