Nov 05, 2013, 8:10 AM
" a is undefined " javaScript error in Line Chart
Hi All.
I make line Chart and after I add it in Items collection of a window and returning it as a result for my CreateLineChart Direct method Call.
The Code is here.
Any help or recommendation is appreciated in advance.
I make line Chart and after I add it in Items collection of a window and returning it as a result for my CreateLineChart Direct method Call.
The Code is here.
Any help or recommendation is appreciated in advance.
public static Window CreateLineChart(string chartID, string XAxeTitle, string YAxeTitle, string XAxeField, string YAxeField, int chartWidth, int chartHeight, string dataLoadURL, string entityID)
{
var dt = new DataTable();
SqlConnection cn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["KSPDBS"].ConnectionString);
SqlDataAdapter da = new SqlDataAdapter("Select * from ViwPDEntityItemLanguageTitles where EntityID=" + entityID + " Order By PresentationSequenceNo", cn);
da.Fill(dt);
var myStore = CreateStore(dt, "s1", "ID", dataLoadURL, null, "ID", 20, true);
Chart myChart = new Chart()
{
ID = "Chrt1",
StyleSpec = "background:#fff;",
Animate = true,
Shadow = true,
StandardTheme = StandardChartTheme.Category1,
LegendConfig = new ChartLegend()
{
Position = LegendPosition.Right,
}
};
NumericAxis myNumAxe = new NumericAxis()
{
Fields = new[] { YAxeField },
Title = YAxeTitle,
Minimum = 0,
MinorTickSteps = 1,
GridConfig = new AxisGrid()
{
Odd = new SpriteAttributes()
{
Opacity = 1,
Fill = "#ddd",
Stroke = "#bbb",
StrokeWidth = 0.5
}
}
};
myChart.Axes.Add(myNumAxe);
CategoryAxis ctgryAxe = new CategoryAxis()
{
Position = Position.Bottom,
Fields = new[] { XAxeField},
Title = XAxeTitle,
};
myChart.Axes.Add(ctgryAxe);
var linSer1 = new LineSeries()
{
Axis = Position.Left,
XField = new[] { XAxeField},
YField = new[] { YAxeField },
HighlightConfig = new SpriteAttributes()
{
Size = 7,
Radius = 7
},
MarkerConfig = new SpriteAttributes()
{
Type = SpriteType.Cross,
Size = 4,
Radius = 4,
StrokeWidth = 0
}
};
var linSer2 = new LineSeries()
{
Axis = Position.Left,
XField = new[] { XAxeField },
YField = new[] { YAxeField },
HighlightConfig = new SpriteAttributes()
{
Size = 7,
Radius = 7
},
MarkerConfig = new SpriteAttributes()
{
Type = SpriteType.Cross,
Size = 4,
Radius = 4,
StrokeWidth = 0
},
Smooth = 3
};
myChart.Series.Add(linSer1);
myChart.Series.Add(linSer2);
myChart.Height = chartHeight - 50;
myChart.Width = chartWidth - 50;
Window myWin = new Window()
{
ID = "w11",
Width = chartWidth,
Height = chartHeight,
Layout = "fit"
};
myChart.Render();
myWin.Items.Add(myChart);
return myWin;
}
Last edited by Daniil; Nov 05, 2013 at 11:33 AM.
Reason: Please use [CODE] tags