질문의 짧은 버전은 모델에 날짜 필드 항목의 특정 부분 만 표시하는 방법이 있습니까?날짜 항목의 개별 부분을 나열하는 방법
예 : 항목으로 02/13/2017을 입력하지만 별도의 페이지에 해당 날짜 또는 월 또는 연도 만보고 싶습니까? 모든 것이 아닙니다.
더 긴 설명. 내가 함께 국면에 다음 코드를 사용하고
타임 라인 만들기에 Google charts script (see previous question) A :
function showChart(widget){
google.charts.load('current', {'packages':['timeline']});
function drawChart() {
var container = widget.getElement();
var chart = new google.visualization.Timeline(container);
var dataTable = new google.visualization.DataTable();
dataTable.addColumn({ type: 'string', id: 'President' });
dataTable.addColumn({ type: 'date', id: 'Start' });
dataTable.addColumn({ type: 'date', id: 'End' });
dataTable.addRows([
[ 'Washington', new Date(1789, 3, 30), new Date(1797, 2, 4) ],
[ 'Adams', new Date(1797, 2, 4), new Date(1801, 2, 4) ],
[ 'Jefferson', new Date(1801, 2, 4), new Date(1809, 2, 4) ]]);
chart.draw(dataTable);
}
google.charts.setOnLoadCallback(drawChart);
}
을 나는 내 모델로부터 데이터 행의 레이블을 대체 할 수있는 변수를 정의 추가/경우 . 예 : RoomName
function showChart(widget){
google.charts.load('current', {'packages':['timeline']});
function drawChart() {
var container = widget.getElement();
var chart = new google.visualization.Timeline(container);
var dataTable = new google.visualization.DataTable();
var RoomName = app.datasources.TestModel.item.RoomName;
dataTable.addColumn({ type: 'string', id: 'President' });
dataTable.addColumn({ type: 'date', id: 'Start' });
dataTable.addColumn({ type: 'date', id: 'End' });
dataTable.addRows([
[ 'RoomName', new Date(1789, 3, 30), new Date(1797, 2, 4) ],
[ 'Adams', new Date(1797, 2, 4), new Date(1801, 2, 4) ],
[ 'Jefferson', new Date(1801, 2, 4), new Date(1809, 2, 4) ]]);
chart.draw(dataTable);
}
google.charts.setOnLoadCallback(drawChart);
}
나는 그러나 새로운 날짜 옵션은 년, 월, 일 예 위 (3 개 변수로 분리했다,에서 확인하여 동일한 작업을 수행하고 날짜를 체크 아웃하고 싶습니다 : 새로운 날짜 (1789, 3, 30) 그래서 app.datasources.TestModel.item.CheckIn을 사용할 수 없습니다.
app make가 app.datasources.TestModel.item.CheckIn으로 말할 수있는 방법이 있나요?), app.datasources.TestModel.item.CheckIn (월), app.datasources.TestModel.item.CheckIn (일)?
도움을 주셔서 감사합니다.
, 나는 날짜 변압기를 사용하는 것이 좋습니다 것입니다 단지뿐만 아니라 https://developers.google.com/appmaker/scripting/api 작동/transformers # formatDate, 스크립트를 사용하여 값을 설정하는 경우 ... 열 설명에 세 번째 속성을 추가 할 수 있습니다 - pattern (https://developers.google.com/chart/interactive/docs/reference#DataTable_addColumn) –