javascript - What is the sort criteria for 'argument field' in dxChart? -


i working in chart syde-by-syde bar, when finished saw order of 'argument field' wrong, sending in right order, chart shown disordered.

i haven't been found nothing in documentation how sort field. grateful if knows trick fix it.

here chart , datasource:

var datasource = [     { state: "01-aug-2017", juan_sebastián: 7,maría_alejandra: 3,josé_tomás: 8,},     { state: "02-aug-2017",juan_sebastián: 1,maría_alejandra: 2, },     { state: "03-aug-2017",maría_alejandra: 3,juan_sebastián: 2,josé_tomás: 4,},     { state: "04-aug-2017",josé_tomás: 2,juan_sebastián: 4,},                                                                                                      { state: "08-aug-2017",josé_tomás: 1, },     { state: "09-aug-2017",maría_alejandra: 1,josé_tomás: 2,},                                                                                                                                                  { state: "10-aug-2017",juan_sebastián: 1,},                                                                                                                      { state: "14-aug-2017",josé_tomás: 1,maría_alejandra: 2,},                                                                                                                 { state: "15-aug-2017",juan_sebastián: 1,},                                                                                                                        { state: "16-aug-2017",juan_sebastián: 1,josé_tomás: 2, },                                                                                                         { state: "17-aug-2017",maría_alejandra: 1,},                                                                                                                     ];  $("#bar-2").dxchart({   equalbarwidth: false,   datasource: datasource,   commonseriessettings: {      argumentfield: "state",      type: "bar"  },   series: [ { valuefield: "juan_sebastián", name: "juan sebastián"}, { valuefield: "maría_alejandra", name: "maría alejandra"}, { valuefield: "josé_tomás", name: "josé tomás"},   ],  legend: {    verticalalignment: "bottom",    horizontalalignment: "center"},  title: "cantidad de casos por abogado"                                     });                                 }); 

and how looks:

enter image description here

i don't know why changing order of original datasource. many thanks!.

when run chart , datasource code above in jsfiddle , here in code snippet, looks correct.

https://jsfiddle.net/jmarking/089j1hrs/

var datasource = [{      state: "01-aug-2017",      juan_sebastián: 7,      maría_alejandra: 3,      josé_tomás: 8,    },    {      state: "02-aug-2017",      juan_sebastián: 1,      maría_alejandra: 2,    },    {      state: "03-aug-2017",      maría_alejandra: 3,      juan_sebastián: 2,      josé_tomás: 4,    },    {      state: "04-aug-2017",      josé_tomás: 2,      juan_sebastián: 4,    },    {      state: "08-aug-2017",      josé_tomás: 1,    },    {      state: "09-aug-2017",      maría_alejandra: 1,      josé_tomás: 2,    },    {      state: "10-aug-2017",      juan_sebastián: 1,    },    {      state: "14-aug-2017",      josé_tomás: 1,      maría_alejandra: 2,    },    {      state: "15-aug-2017",      juan_sebastián: 1,    },    {      state: "16-aug-2017",      juan_sebastián: 1,      josé_tomás: 2,    },    {      state: "17-aug-2017",      maría_alejandra: 1,    },  ];    $("#bar-2").dxchart({    equalbarwidth: false,    datasource: datasource,    commonseriessettings: {      argumentfield: "state",      type: "bar"    },    series: [{        valuefield: "juan_sebastián",        name: "juan sebastián"      },      {        valuefield: "maría_alejandra",        name: "maría alejandra"      },      {        valuefield: "josé_tomás",        name: "josé tomás"      },      ],    legend: {      verticalalignment: "bottom",      horizontalalignment: "center"    },    title: "cantidad de casos por abogado"  });
<script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-3.1.0.min.js"></script>  <link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/17.1.6/css/dx.common.css" />  <link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/17.1.6/css/dx.light.css" />  <script type="text/javascript" src="https://cdn3.devexpress.com/jslib/17.1.6/js/dx.all.js"></script>  <div id="bar-2"></div>


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -