我正在使用 Google Visualization API 生成注释图表。我从我的数据库中获取文章及其日期。日期采用字符串格式“YYYYMMDD”。
在为图表创建数据表时,我使用以下代码添加日期。
dataTable.addColumn('date', 'ArticleDate');
dataTable.addColumn('string', 'ArticleInfo');
for(i=0;i<searchResultsJSON.length;i++){
var yearValue = parseInt(searchResultsJSON[i].date.substr(0,4));
var monthValue = parseInt(searchResultsJSON[i].date.substr(4,6)) - 1;
var dayValue = parseInt(searchResultsJSON[i].date.substr(6,8));
dataTable.addRow([Date(yearValue,monthValue,dayValue),'<a class=\"tooltipLink\" onclick=\"getDoc(\''+searchResultsJSON[i].path+'\');return false;\">'+searchResultsJSON[i].title+'</a><br/\><br/\>']);
}
Run Code Online (Sandbox Code Playgroud)
现在,我想知道每天的文章数量,因此我对数据表运行了聚合查询。
var result = google.visualization.data.group(dataTable,[0],[{'column': 0, 'aggregation': google.visualization.data.count, 'type': 'date'}]);
Run Code Online (Sandbox Code Playgroud)
但是,我在这一点上遇到了日期格式错误。
Error: Type mismatch. Value Mon Jun 16 2014 13:08:20 GMT+0200 (W. Europe Daylight Time) does not match type date in column index 0
at Error (native)
Run Code Online (Sandbox Code Playgroud)
这已经占用了上午的大部分时间,并且确实阻碍了进展。任何帮助都会很棒。
谢谢!
我正在MarkLogic 7上CentOS 6.5 box.我的HTML/JS应用程序托管在同一台机器上的MarkLogic HTTP服务器上.应用程序在端口8003上运行,需要通过REST API在不同的端口8007上运行来访问数据.当我AJAX在我的应用程序中使用请求时,我收到错误说
No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://172.16.100.104:8003' is therefore not allowed access.
Run Code Online (Sandbox Code Playgroud)
有没有人设置MarkLogic为CORS早?任何帮助都会很棒.
我正在尝试在 周围创建一个通用包装器TestBed.createComponent,它接受一个类型参数并为该类型创建组件。但是,该TestBed.createComponent函数采用类型为 的参数Type<T>。我无法Type<T>从传入的泛型 T 参数中创建一个。
export function createTestHarness<T>(): TestHarness<T> {
let component: T;
let fixture: ComponentFixture<T>;
fixture = TestBed.createComponent<T>(**PROBLEM AREA**);
component = fixture.componentInstance;
fixture.detectChanges();
return new TestHarness<T>(component, fixture);
}Run Code Online (Sandbox Code Playgroud)
有没有办法Type<T>从传入的类型派生 a ?