Skip to main content
Version: 5.17.0

GetChartContents

public BackendReturnObject GetChartContents(string chartFileId);

Note on function improvement

The new CDN chart feature, which significantly improves the speed of the existing chart functionality, is now available.\ Please use this feature for much faster data look up and storage.

Parameters

ValueTypeDescription
chartFileIdstringChart file uuid/id
[version1] : bro.GetReturnValuetoJSON()["rows"][i]["selectedChartFile"]["M"]["uuid"]["S"]
[version2] : bro.GetReturnValuetoJSON()["rows"][i]["selectedChartFileId"]["N"]

Description

Looks up Excel file data of the chart applied in the console.

When using OLD charts, you must call the GetChartList method before calling the GetChartContents method.

Example

Synchronous

Backend.Chart.GetChartContents("selectedChartFileId");

Asynchronous

Backend.Chart.GetChartContents("selectedChartFileId", (callback) =>
{
// Post-process
});

SendQueue

SendQueue.Enqueue(Backend.Chart.GetChartContents, "selectedChartFileId", (callback) =>
{
// Post-process
});

ReturnCase

Success cases

When the lookup is successful\ statusCode : 200\ message : Success\ returnValue : refer to GetReturnValuetoJSON

Error case

When an invalid uuid/id is entered\ statusCode : 400\ errorCode : BadParameterException\ message : bad chart uuid/id, Invalid chart uuid/id

GetReturnValuetoJSON

{
rows:
[
{
num: { S: "1" }, // row num(number)
column1: { S: "contents1" },
column2: { S: "contents2" },
column3: { S: "contents3" }
},
{
num: [Object],
column1: [Object],
column2: [Object],
column3: [Object]
}
]
}

Sample Code

This sample code is a class made using the BACKND sample chart.\ For more information about sample charts, please refer to BACKND Console Guide - Chart Management.

// This item was made using the BACKND sample chart provided by default.  
// Please change the variables to match the column names in the chart you have uploaded
public class ChartItem
{
public string itemID;
public string itemName;
public string hpPower;
public string percent;

public override string ToString()
{
return $"itemID : {itemID}\n" +
$"itemName : {itemName}\n" +
$"hpPower : {hpPower}\n";
}
}
public void GetChartContentsTest()
{
string selectedProbabilityFileId = "560";

var bro = Backend.Chart.GetChartContents(selectedProbabilityFileId);

if(!bro.IsSuccess())
{
Debug.LogError(bro.ToString());
return;
}

LitJson.JsonData json = bro.FlattenRows();

List<ChartItem> itemList = new List<ChartItem>();

for(int i = 0; i < json.Count; i++)
{
ChartItem item = new ChartItem();

item.itemID = json[i]["itemID"].ToString();
item.itemName = json[i]["itemName"].ToString();
item.hpPower = json[i]["hpPower"].ToString();

itemList.Add(item);
}

foreach(var item in itemList)
{
Debug.Log(item.ToString());
}

Debug.Log("Total number of chart items : " + itemList.Count);
}