Skip to main content
Version: 5.9.6

GetChartContents

public BackendReturnObject GetChartContents(string chartFileId);

Parameter

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
});

Return cases

Success cases

When the lookup is successful
statusCode : 200

returnValue : refer to GetReturnValuetoJSON

Error case

When the wrong uuid/id is entered
statusCode : 400
errorCode : BadParameterException

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);
}