본문으로 건너뛰기
버전: SDK-5.11.7

GetChartContents

public BackendReturnObject GetChartContents(string chartFileId);

파라미터

ValueTypeDescription
chartFileIdstring차트 파일의 uuid 혹은 id

[version1] : bro.GetReturnValuetoJSON()["rows"][i]["selectedChartFile"]["M"]["uuid"]["S"]
[version2] : bro.GetReturnValuetoJSON()["rows"][i]["selectedChartFileId"]["N"]|

설명

콘솔에서 적용한 차트의 엑셀파일의 데이터를 조회합니다.

OLD 차트를 사용하는 경우 GetChartContents 함수를 호출하기 전에 반드시 GetChartList 함수를 호출해야 합니다.

Example

동기

Backend.Chart.GetChartContents("selectedChartFileId");

비동기

Backend.Chart.GetChartContents("selectedChartFileId", (callback) =>
{
// 이후 작업
});

SendQueue

SendQueue.Enqueue(Backend.Chart.GetChartContents, "selectedChartFileId", (callback) =>
{
// 이후 작업
});

ReturnCase

Success cases

조회에 성공한 경우
statusCode : 200
message : Success
returnValue : GetReturnValuetoJSON 참조

Error case

올바르지 못한 uuid / id를 입력한 경우
statusCode : 400
errorCode : BadParameterException
message : bad chart uuid/id, 잘못된 chart uuid/id 입니다

GetReturnValuetoJSON

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

Sample Code

해당 예제코드는 뒤끝의 예제 차트를 이용하여 만든 class입니다.
예제 차트에 대해서는 뒤끝 콘솔가이드 - 차트 관리를 참고해주세요.

// 뒤끝의 기본 제공 차트를 이용하면 만든 아이템입니다.  
// 업로드하신 차트의 컬럼명에 맞게 변수를 변경해주시기 바랍니다
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("차트 아이템의 총 갯수 : " + itemList.Count);
}