Highchart post 47102....

Hallo Gemeinde,

ich bastel gerade etwas an einem Highchart für mich herum.

Ich würde gerne täglich mein Gewicht (oh mein Gott…ich kann darüber reden) erfassen und in Highchart anzeigen lassen.

Das geht soweit auch alles, nur scheint Highchart meine Werte etwas zu glätten.
Ich hätte aber gerne das tasächliche Gewicht, das ich eingegeben habe angezeigt. (z.B. bei Mouseover)
Das funktioniert irgendwie nur bei dem ersten und letzten Wert.
Die Werte dazwischen (ca. 10 Beispieleinträge gemacht) werden irgendwie geglättet…

Leider bin ich nicht so der Highchartprofi…eventuell findet ja einer von euch die Stelle, an der ich das modifizieren müßte.

Die 3D Anzeige zu aktivieren habe ich auch nicht geschafft…aber das wäre von der Prio nich so wichtig, nur falls das einer so nebenbei lösen möchte :slight_smile:

Vielen Dank für die Hilfe
Sascha

<?
 ##### Project Exporter Comment: Script Version Stand 05.05.2014 18:10 #####


################## User-Konfig #############################################################

	$Gewicht_Sascha                                       	= 26730 /*[Entwicklungsbereich Sascha\Diät\Links\Gewicht Test]*/;


################## IPS-Konfig ##############################################################

   // HighCharts PHP includen
	include							  									  	  "53533.ips.php";

	// Zeitraum
	$ts                        										= mktime(0,0,0, date("m")-1, date("d"), date("Y"));
	$te                        										= mktime(23,59,59, date("m")+1, date("d"), date("Y"));
	$ts_yet  																= date("(D) d.m.Y H:i", $ts);
	$te_yet  																= date("(D) d.m.Y H:i", $te);
	$Filename      														= $_IPS['SELF'].".hc.php";
	$Path          														= "user/RS_HighCharts/tmp/";
	$HC_Content_ID                                           = 58838 /*[Entwicklungsbereich Sascha\Diät\Oben\Highchart]*/;
	$Chart_Height                                            = 360;

	// AC-Handler definieren
   define("AC_HANDLER_ID", IPS_GetInstanceListByModuleID('{43192F0B-135B-4CE7-A0A7-1475603F3060}')[0]);

################## HC-Konfig ###############################################################
   $chart 																	= new Highchart();

	// Chart-Titel
	$chart->title->text			 										= "Gewichtsverlauf Sascha";
	$chart->title->style->color			 							= 'rgba(255,255,255, 1.0)';
	$chart->title->style->fontSize			 						= '14px';
	$chart->subtitle->text			 									= 'Zeitraum: '.$ts_yet.' - '.$te_yet;
	$chart->subtitle->style->color			 						= 'rgba(255,255,255, 0.7)';

	// Chart Config I
	$chart->chart->type 													= "column";


################### Chart Series ##################################################################################################
	$S_ID                                                 	= 0;                 // Series-ID
	// Forecast heute (Median-Modell)
	$RoundedValue                                            = 2;
	$chart->series[$S_ID]->name										= "Gewicht Sascha";
	$chart->series[$S_ID]->data 										= IPS_Array_to_HCData($RoundedValue, array_reverse(AC_GetAggregatedValues(AC_HANDLER_ID, $Gewicht_Sascha, 5, $ts, $te, 3600)));
	$chart->series[$S_ID]->zIndex 									= 80;
	$chart->series[$S_ID]->type 										= "line";
	$chart->series[$S_ID]->step 										= true;
	$chart->series[$S_ID]->yAxis 										= 0;
	$chart->series[$S_ID]->visible 									= true;
	$chart->series[$S_ID]->showInLegend 							= true;
	$chart->series[$S_ID]->enableMouseTracking 					= true;
	$chart->series[$S_ID]->color 										= 'rgba(0,255,0, 0.9)';//'#FF7B00';
	$chart->series[$S_ID]->shadow 									= true;
	$chart->series[$S_ID]->marker->enabled 						= false;


	// Achsen-Definitionen ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
	// y-Axis

	// y-Axis 0
	$yAxID                                                	= 0;
	$chart->yAxis[$yAxID]->title->text 								= "Gewicht (Kg)";
	$chart->yAxis[$yAxID]->title->style->color 					= 'rgba(255,255,255, 0.8)';
   $chart->yAxis[$yAxID]->unit 										= NULL;
	$chart->yAxis[$yAxID]->opposite 									= true;
	$chart->yAxis[$yAxID]->allowDecimals 							= true;
	$chart->yAxis[$yAxID]->min 										= 80;
	$chart->yAxis[$yAxID]->tickInterval 							= 1;
	$chart->yAxis[$yAxID]->max 										= 110;
	$chart->yAxis[$yAxID]->gridLineWidth                  	= 1;
	$chart->yAxis[$yAxID]->gridLineColor                  	= 'rgba(255,255,255, 0.1)';
	$chart->yAxis[$yAxID]->labels->style->color 					= 'rgba(255,255,255, 0.8)';

	// y-Axis 1
	$yAxID++; //                                                	= 1;
	$chart->yAxis[$yAxID]->title->text 								= "";
	$chart->yAxis[$yAxID]->title->style->color 					= 'rgba(255,255,255, 0.8)';
   $chart->yAxis[$yAxID]->unit 										= NULL;
	$chart->yAxis[$yAxID]->opposite 									= false;
	$chart->yAxis[$yAxID]->allowDecimals 							= true;
	$chart->yAxis[$yAxID]->min 										= NULL;
	$chart->yAxis[$yAxID]->tickInterval 							= NULL;
	$chart->yAxis[$yAxID]->max 										= NULL;
	$chart->yAxis[$yAxID]->gridLineWidth                  	= 1;
	$chart->yAxis[$yAxID]->gridLineColor                  	= 'rgba(255,255,255, 0.1)';
	$chart->yAxis[$yAxID]->labels->style->color 					= 'rgba(255,255,255, 0.8)';

	// x-Axis
	$chart->xAxis->type                                		= 'datetime';
	$chart->xAxis->max                       						= $te*1000;
	$chart->xAxis->labels->style->color                      = 'rgba(255,255,255, 0.6)';
	$chart->xAxis->gridLineWidth                       		= 1;
	$chart->xAxis->gridLineColor                       		= 'rgba(255,255,255, 0.1)';

	// Legend
	$chart->legend->align                           			= 'center';
	$chart->legend->backgroundColor                    		= 'rgba(255,255,255, 0.0)';
	$chart->legend->itemStyle->color                  			= 'rgba(255,255,255, 0.8)';
	$chart->legend->itemStyle->fontWeight                  	= 'normal';
	$chart->legend->itemHiddenStyle->color                	= 'rgba(255,255,255, 0.3)';
	$chart->legend->itemHoverStyle->color                  	= 'rgba(255,255,255, 1.0)';

	// Chart-Config "Credits" by RS
	$chart->credits->enabled                           		= true;
   $chart->credits->href                           			= 'http://www.raketenschnecke.net';
	$chart->credits->text                           			= 'www.raketenschnecke.net';
	$chart->credits->position->align                  			= "right";
	$chart->credits->position->x                  				= -10;
	$chart->credits->position->verticalAlign           		= 'top';
	$chart->credits->position->y                  				= 15;

	// plotOptions
	$chart->plotOptions->series->states->hover->brightness 	= 0.1;
	$chart->plotOptions->column->stacking							= 'normal';
	$chart->plotOptions->column->borderColor						= '#EFEFEF';
	$chart->plotOptions->column->borderWidth						= 1;
	$chart->plotOptions->column->shadow								= false;
	$chart->plotOptions->column->pointPadding						= -0.05;
	$chart->plotOptions->column->groupPadding						= 0.2;
	$chart->plotOptions->series->states->hover->brightness	= 0.2;

	// exporting
	$chart->exporting->enabled 										= false;
	$chart->navigation->enabled 										= false;

	// Tooltip
   $chart->tooltip->useHTML                           		= true;
   $chart->tooltip->backgroundColor                         = 'rgba(0,0,0, 0.7)';
   $chart->tooltip->shared                           			= true;
   $chart->tooltip->crosshairs[0]                     		= false;
   $chart->tooltip->crosshairs[1]                     		= array('width' =>1,'color' =>'grey','dashStyle'=>'longdash' );
   $chart->tooltip->style->color                      		= 'rgba(255,255,255, 0.9)';
   $chart->tooltip->style->fontSize                   		= '10px';
   $chart->tooltip->style->padding                  			= '8px';
//	$chart->tooltip->formatter 										= new HighchartJsExpr(formatter_String());

	// Chart Config II
	$chart->chart->renderTo 											= "container";
	$chart->chart->backgroundColor 									= "rgba(255,255,255, 0.0)";
	$chart->chart->plotBorderWidth                        	= 1;
	$chart->chart->plotBorderColor                        	= "rgba(255,255,255, 0.5)";
	$chart->chart->marginBottom 										= 70;
	$chart->chart->height 												= $Chart_Height;
	$chart->chart->zoomType		 										= 'x';

// HC-Options (global, lang)
   $option 																	= new HighchartOption();
	$option->global->useUTC 											= false;
   $option->lang->decimalPoint 										= ',';
   $option->lang->thousandsSep										= ".";
   $option->lang->months 												= array('Januar', 'Februar','Mrz', 'April','Mai', 'Juni','Juli', 'August','September', 'Oktber','November', 'Dezember');
   $option->lang->shortMonths 										= array('Jan', 'Feb','Mrz', 'Apr','Mai', 'Jun','Jul', 'Aug','Sep', 'Okt','Nov', 'Dez');
   $option->lang->weekdays 											= array('Sonntag', 'Montag', 'Dienstag','Mittwoch', 'Donnerstag','Freitag', 'Samstag');

################################ Ausgabe ##############################################################
// HC-Content in String umformen (für Einbau in HTML-Content)
	$HC_Option     														= Highchart::setOptions($option);
	$HC_Chart 																= $chart->render("chart");

// Pfadangaben für .js-Scripte (jquery, Highcharts). Die .js-Scripte sollten nur dann geladen werden, wenn sie wirklich im Chart benötigt werden (Performance im WFE!)
	$js_Scripts[]   														= '/user/RS_HighCharts/jquery/2.1.0/jquery.min.js';
	$js_Scripts[]       													= '/user/RS_HighCharts/js/highcharts.js';
//	$js_Scripts[]  														= '/user/RS_HighCharts/js/highcharts-more.js';
//	$js_Scripts[]	   													= '';

// HTML-Content in Variable schreiben
	$Content       														= HTML_Content($js_Scripts, $HC_Chart, $HC_Option);
	setValue($HC_Content_ID ,  '<iframe src="./'.$Path.$Filename.'" width="100%" height="'.$Chart_Height.'" name="HighChart" scrolling="no" marginheight="0" marginwidth="0" frameborder="0">');
	write_content($Path, $Filename, $Content);

################################ Functions #############################################################

function formatter_String()
{
global $WeekDay;
$s =
"function() {
	var s 	= '<b>' + Highcharts.dateFormat('%H Uhr', this.x) +'</b>';

	s += '<table cellspacing=\"0\" cellpadding=\"0\" width=\"195px\" style=\" font-size:12px; color:rgba(255,255,255, 0.9);\">';
	s += '<tr><td style=\"width:15px; height:5px;\"> </td><td style=\"width:100px;\"> </td><td style=\"width:80px;\"> </td></tr>';

	$.each(this.points, function(i, point) {
	[this.series.name];
	if((point.series.name == 'Strom1') || (point.series.name == 'Temperatur'))
	{

	   s += '<tr><td colspan=\"2\">' + '<span style=\"color:' + point.series.color + '\">' + point.series.name +': </span></td><td align=right style=\"color:' + point.series.color + '\">' + point.y.toFixed(1) + ' kWh</td></tr>';
	}
	else
	{
	   s += '<tr><td colspan=\"2\">' + '<span style=\"color:' + point.series.color + '\">' + point.series.name +': </span></td><td align=right style=\"color:' + point.series.color + '\">' + point.y.toFixed(1) + ' °C</td></tr>';
	}

	});
	s += '</table>';
	return s;
	}";

return $s;
}


?>