Currently working with ASP.NET and devextreme component. My question is: How can I name my "series" of the graph from the C # code? Devextreme shows how to do it from the client side but not from the server side.
My project example is very similar to the example taken on this page: link )
Arguments and values work fine, but not series.
This is my code, but it does not work:
Jscript:
$(function () {
$("#chartContainer").dxChart({
dataSource: chartData,
commonSeriesSettings: {
type: "line",
hoverMode: "allArgumentPoints",
selectionMode: "allArgumentPoints",
label: {
visible: false,
},
},
tooltip: {
enabled: true,
format: "fixedPoint",
precision: 2,
customizeText: function () {
return this.valueText + ' Q';
}
},
series: [
{ argumentField: 'argumento1', valueField: 'valor1', name: 'Ano_A', color: 'DarkSeaGreen' },
{ argumentField: 'argumento2', valueField: 'valor2', name: 'Ano_B', color: 'LightBlue' },
],
argumentAxis: {
tickInterval: 1,
},
legend: {
horizontalAlignment: 'center'
}
}); });
Datahelper C #:
using System;
using System.Collections;
using System.Collections.Generic;
using Dashboard.ks.Dashboard.ks;
public class DataHelper
{
public DataHelper()
{
Dashboard.Query.Sale.Instance.ListSaleDaily = Dashboard.Query.Sale.LevelOne.UnionOrderSale();
}
public IEnumerable GetItemsQ()
{
List<KBInfo> kbItems = new List<KBInfo>();
foreach (var day in inicio.ListA)
{
kbItems.Add(new KBInfo()
{
argumento1 = (day.Day),
valor1 = (day.Qtysold),
// Ano_A=(inicio.Ano),
Ano_A = 2016,
});
}
foreach (var day in inicio.ListB)
{
kbItems.Add(new KBInfo()
{
argumento2 = (day.Day),
valor2 = (day.Qtysold),
// Ano_B = (inicio.Ano - 1),
Ano_B = 2015,
});
}
return kbItems;
}
}
public class KBInfo
{
public int argumento1 { get; set; }
public int argumento2 { get; set; }
public decimal valor1 { get; set; }
public decimal valor2 { get; set; }
public int Ano_A { get; set; }
public int Ano_B { get; set; }
}