Hi,
Following on from the excellent help so far from Telerik I am now on the final part of my chart but once again seem to have come up short. I essentially have two questions regarding getting data and the other on showing legends when added manually from JavaScript
Accessing Data
When I create the chart I find the template feature very helpful but am having trouble getting some data items for the tool-tip as well as legends (which is why I ask question two), my structure is:
So in the above example how would I show the "Name" part which is essentially my Y axis in the chart from the template as the following does not work, or should I look at flattening out the objects?
2 - Manually Add Legends
The second question is related to adding legends, I would like the name from the above structure to be added as legends to the chart, I'm doing the following to add them:
When doing this and running though the chrome debugger console I can see the results
Yet nothing shows on the chart so I'm guessing I'm missing something so any help would be appreciated on this.
Regards
Mike
Following on from the excellent help so far from Telerik I am now on the final part of my chart but once again seem to have come up short. I essentially have two questions regarding getting data and the other on showing legends when added manually from JavaScript
Accessing Data
When I create the chart I find the template feature very helpful but am having trouble getting some data items for the tool-tip as well as legends (which is why I ask question two), my structure is:
public
class
ClassOne
{
public
ClassOne()
{
Sites =
new
List<ClassTwo>();
}
public
string
FieldOne {
get
;
set
; }
public
string
FieldTwo {
get
;
set
; }
public
List<ClassTwo> Sites {
get
;
set
; }
}
public
class
ClassTwo
{
public
decimal
Value {
get
;
set
; }
public
string
Name {
get
;
set
; }
}
So in the above example how would I show the "Name" part which is essentially my Y axis in the chart from the template as the following does not work, or should I look at flattening out the objects?
.Template(
"#= category # : #= dataItem.Name ##= kendo.toString(value, 'n') #"
)
2 - Manually Add Legends
The second question is related to adding legends, I would like the name from the above structure to be added as legends to the chart, I'm doing the following to add them:
var
leg = [];
for
(
var
website = 0; website < websiteCount; website++) {
leg.push(ds[0].WebSite[website].WebSiteName);
}
chartOptions.legend.labels = leg;
chart.redraw();
When doing this and running though the chrome debugger console I can see the results
chart.options.legend
Object
{
labels: Array[9],
inactiveItems: Object,
visible:
true
, position:
"bottom"
}
inactiveItems: Objectlabels: Array[9]
0:
"SITE1"
1:
"SITE2"
2:
"SITE3"
3:
"SITE4"
4:
"SITE5"
5:
"SITE6"
6:
"SITE7"
7:
"SITE8"
8:
"SITE9"
length: 9
__proto__: Array[0]
position:
"bottom"
visible:
true
__proto__: Object
Yet nothing shows on the chart so I'm guessing I'm missing something so any help would be appreciated on this.
Regards
Mike