-
+
" . Yii::t('app/messages', 'No result found.') . "
";
} else {
- $series = [];
- foreach ($data["scientificObjectData"][0]["dataFromProvenance"]as $dataFromProvenanceKey => $dataFromProvenanceValue) {
- $series[] = ['name' => $dataFromProvenanceKey,
- 'data' => $dataFromProvenanceValue];
- }
+
$url2 = Url::to(['image/search-from-scientific-object']);
$objectURI = $model->uri;
- if ($show) {
- echo Highcharts::widget([
- 'id' => 'graphic',
- 'options' => [
- 'chart' => [
- 'zoomType' => 'x'
- ],
- 'title' => [
- 'text' => $variables[$data["variable"]]
- ],
- 'subtitle' => [
- 'text' => Yii::t('app/messages', 'Click and drag in the plot area to zoom in!')
- ],
- 'xAxis' => [
- 'type' => 'datetime',
- 'title' => 'Date'],
- 'yAxis' => [
- 'title' => null,
- 'labels' => [
- 'format' => '{value:.2f}'
+
+ $series = [];
+ foreach ($data as $dataFromProvenanceKey => $dataFromProvenanceValue) {
+ $series[] = [
+ 'name' => $provenancesArray[$dataFromProvenanceKey],
+ 'data' => $dataFromProvenanceValue["data"],
+ 'id' => $dataFromProvenanceKey,
+ 'visible' => true,
+ ];
+ $photoSerie=null;
+ if (!empty($dataFromProvenanceValue["photosSerie"])) {
+
+ foreach ($dataFromProvenanceValue["photosSerie"] as $photoKey => $photoValue) {
+ $photoSerie[] = [
+ 'x' => $photoKey,
+ 'title' => ' ',
+ ];
+ }
+ $imageSerieName='images/'.$provenancesArray[$dataFromProvenanceKey];
+ $series[] = [
+ 'type' => 'flags',
+ 'name' => $imageSerieName,
+ 'data' => $photoSerie,
+ 'onSeries' => $dataFromProvenanceKey,
+ 'width' => 8,
+ 'height' => 8,
+ 'shape' => 'circlepin',
+ 'lineWidth' => 1,
+ 'point' => [
+ 'events' => [
+ 'stickyTracking' => false,
+ 'mouseOver' => new JsExpression("
+ function () {
+ const pointIndex=this.index;
+ const serieIndex=this.series.index;
+ $('#visualization-images-list li a img').each(function (index, value) {
+ $(this).css('border-bottom', '');
+ const point = Number($(this).attr('data-point'));
+ const serie = Number($(this).attr('data-serie'));
+ if(pointIndex===point&&serieIndex===serie){
+ $(this).css('border', 'solid 2px orange');
+ }
+ });
+ }"),
+ 'mouseOut' => new JsExpression("function () {
+ $('#visualization-images-list li a img').each(function (index, value) {
+ $(this).css('border', '');
+ });
+ }")
]
],
- 'series' => $series,
- 'tooltip' => [
- 'xDateFormat' => '%Y-%m-%d %H:%M',
- ],
- 'plotOptions' => [
- 'series' => [
- 'cursor' => 'pointer',
- 'point' => [
- 'events' => [
- 'click' => new JsExpression(" function() {"
- . "var searchFormData = new FormData();"
- . "console.log( Highcharts.dateFormat('%Y-%m-%dT%H:%M:%S+0200', 1500768000000));"
- . "searchFormData.append('concernedItems[]', \"$objectURI\");"
- . "searchFormData.append('DataFileSearch[rdfType]',\"$imageTypeSelected\");"
- . "searchFormData.append('jsonValueFilter', \"$filterToSend\");"
- . "searchFormData.append('startDate',Highcharts.dateFormat('%Y-%m-%dT%H:%M:%S+0000', this.x));"
- . "searchFormData.append('endDate',Highcharts.dateFormat('%Y-%m-%dT%H:%M:%S+0000', this.x));"
- . "searchFormData.append('imagesCount',$('#imagesCount').attr('data-id'));"
- . "$.ajax({url: \"$url2\","
- . " type: 'POST',"
- . " processData: false,"
- . " datatype: 'json',"
- . " contentType: false,"
- . " data: searchFormData,"
- . "}).done(function (data) {onDayImageListHTMLFragmentReception(data);}
- ).fail(function (jqXHR, textStatus) {alert('ERROR : ' + jqXHR);});}")
- ]
- ],
- ]
+ 'events' => [
+ 'click' => new JsExpression("
+ function (event) {
+ var searchFormData = new FormData();
+ searchFormData.append('concernedItems[]', \"$objectURI\"); "
+ . " searchFormData.append('serieIndex', this.index);"
+ . " searchFormData.append('pointIndex', event.point.index);"
+ . " searchFormData.append('DataFileSearch[rdfType]',\"$imageTypeSelected\");"
+ . " searchFormData.append('jsonValueFilter', \"$filterToSend\");"
+ . " searchFormData.append('startDate',Highcharts.dateFormat('%Y-%m-%dT%H:%M:%S+0000', event.point.x));"
+ . " searchFormData.append('endDate',Highcharts.dateFormat('%Y-%m-%dT%H:%M:%S+0000', event.point.x));"
+ . " searchFormData.append('imagesCount',$('#imagesCount').attr('data-id'));"
+ . " $.ajax({"
+ . " url: \"$url2\","
+ . " type: 'POST',"
+ . " processData: false,"
+ . " datatype: 'json',"
+ . " contentType: false,"
+ . " data: searchFormData,"
+ . " }).done(function (data) {"
+ . " onDayImageListHTMLFragmentReception(data);}"
+ . " ).fail(function (jqXHR, textStatus) {"
+ . " alert('ERROR : ' + jqXHR);});}")
]
- ]
- ]);
- } else {
- echo Highcharts::widget([
- 'id' => 'graphic',
- 'options' => [
- 'time' => ['timezoneOffset' => -2 * 60],
- 'chart' => [
- 'zoomType' => 'x'
- ],
- 'title' => ['text' => $variables[$data["variable"]]],
- 'subtitle' => [
- 'text' => 'Click and drag in the plot area to zoom in'
- ],
- 'xAxis' => [
- 'type' => 'datetime',
- 'title' => 'Date',
- ],
- 'yAxis' => [
- 'title' => null,
- 'labels' => [
- 'format' => '{value:.2f}'
- ]
+ ];
+ }
+ }
+
+ foreach ($events as $event) {
+ $Eventsdata[] = [
+ 'x' => $event['date'],
+ 'title' => $event['title'],
+ 'text' => $event['id'],
+ 'color'=>$colorByEventCategorie[$event['title']]
+ ];
+ }
+ usort($Eventsdata, function ($item1, $item2) {
+ return $item1['x'] <=> $item2['x'];
+ });
+
+ $viewDetailUrl = Url::to(['event/ajax-view']);
+ $eventsTab[] = [
+ 'type' => 'flags',
+ 'allowOverlapX' => true,
+ 'name' => 'Events',
+ 'lineWidth' => 1,
+ 'y' => -40,
+ 'clip' => false,
+ 'data' => $Eventsdata,
+ 'events' => [
+ 'click' => new JsExpression("
+ function (event) {
+ const eventId=event.point.text;
+
+ $.ajax({"
+ . " url: \"$viewDetailUrl\","
+ . " type: 'GET',"
+ . " datatype: 'json',"
+ . " data: {
+ id: eventId},"
+ . " }).done(function (data) {"
+ . " renderEventDetailModal(data);"
+ . " console.log('ok');}"
+ . " ).fail(function (jqXHR, textStatus) {"
+ . " alert('ERROR : ' + jqXHR);});
+ }")
+ ]
+ ];
+ $series[] = $eventsTab[0];
+
+ $eventCreateUrl = Url::to(['event/create',
+ EventController::PARAM_CONCERNED_ITEMS_URIS => [$objectURI],
+ EventController::PARAM_RETURN_URL => Url::current()]);
+
+ $options = [
+ 'id' => 'graphic',
+ 'options' => [
+ 'time' => ['timezoneOffset' => -2 * 60],
+ 'chart' => [
+ 'zoomType' => 'xy',
+ 'type' => 'line',
+ ],
+ 'title' => [
+ 'text' => $variableInfo['label']
+ ],
+ 'subtitle' => [
+ 'text' => Yii::t('app/messages', 'Click on a serie to add an event!')
+ ],
+ 'navigator' => [
+ 'enabled' => true,
+ 'margin' => 5,
+ 'y' => -4
+ ],
+ 'legend' => [
+ 'layout' => 'vertical',
+ 'enabled' => true,
+ ],
+ 'xAxis' => [
+ 'type' => 'datetime',
+ 'title' => [
+ 'text' => 'time'
],
- 'series' => $series,
- 'tooltip' => [
- 'xDateFormat' => '%Y-%m-%d %H:%M',
+ 'ordinal' => false,
+ 'crosshair' => true,
+ ],
+ 'yAxis' => [
+ 'title' => [
+ 'text' => $variableInfo['label']
],
- 'plotOptions' => [
- 'series' => [
- 'cursor' => 'pointer',
- 'point' => [
- 'events' => [
- 'click' => new JsExpression(" function() {"
- . "}")
- ]
+ 'labels' => [
+ 'format' => '{value:.2f}'
+ ]
+ ],
+ 'series' => $series,
+ 'tooltip' => [
+ 'xDateFormat' => '%Y-%m-%d %H:%M',
+ 'formatter' => new JsExpression("function(tooltip) {
+ if(this.points){
+ return tooltip.defaultFormatter.call(this, tooltip);
+ } else if(this.series.name=='Events'){
+ const content = '
' + this.point.title + '';
+ return content;
+ } else {
+ return '';
+ }
+ }")
+ ],
+ 'plotOptions' => [
+ 'series' => [
+ 'dataGrouping' => [
+ 'enabled' => false
+ ],
+ 'marker' => [
+ 'states' => [
+ 'hover' => [
+ 'enabled' => true
+ ],
+ 'radius' => 2
]
+ ],
+ 'events' => [
+ 'click' => new JsExpression("
+ function (event) {
+ var real=this.xAxis.toValue(event.chartX, false);
+ if(this.name!=='Events'){
+ var dateParams = '&dateWithoutTimezone='+Highcharts.dateFormat('%Y-%m-%dT%H:%M:%S+0000',real);
+ $('#createEventLink').attr('href',\"$eventCreateUrl\"+dateParams);
+ $('#add-events-lightbox').modal('show') ;
+ }
+ }")
]
]
]
- ]);
- }
+ ]
+ ];
+
+ echo Highstock::widget($options);
}
}
?>
+
+
+
+