Fatih Çelik
Fatih Çelik

Reputation: 541

Custom field name in ECharts

I designed a console app. User can create report widgets (also selecting graph type, line, pie, etc...) and link to rest api functions. Then system binds rest api data (i don't know the data fields, user typing names in the screen) with report widgets and also related graphs.

I'm using D3.js for live dashboard (contains report widgets). But D3.js is not good choise for dynamic reports and dynamic ajax data. Because D3.js implemantation differs from chart to chart, it is not developer friendly like highcharts, echarts.

But highcharts, echarts and other charts' field name is not configurable. In Kendo it can be done like this:

series: [
    { field: "price" }
  ]

Is there any way to do this in HighCharts or eCharts. Or Can you suggest any other chart libraries (prefer free/open source)?

UPDATE: I'm not using eCharts any more. C3.js is more stable and easy to use. C3.js has same problem, but now i prepare custom data array and it is working.

chart.graph.load({
   columns: [
       GetTextData(serieData, "x"),
       SerializeDataWithSerieName("blabla", serieData)
   ]
});
....
function GetTextData(data, textToInsertStart) {
     var result = [];
     if (textToInsertStart)
         result.push(textToInsertStart);

     for (var i = 0; i < data.length; i++) {
        result.push(data[i][MyTextFieldName]);
     }
     return result;
}
....
function SerializeDataWithSerieName(serieName, data) {
     var result = [];
     result.push(serieName);
     for (var i = 0; i < data.length; i++) {
        result.push(data[i][MyDataFieldName]);
     }
     return result;
 }

Upvotes: 0

Views: 1858

Answers (1)

Farhad Azarbarzinniaz
Farhad Azarbarzinniaz

Reputation: 739

you can set options of your series but it's related on your series type

see below link for more details.

https://ecomfe.github.io/echarts/doc/doc-en.html#Series

series: [
    { name: "price" }
  ]

every thing about series are explained in more details in Echarts doc please visit the link you will find more .

Upvotes: 1

Related Questions