Décidément, j'ai l'art de poser des questions stupides (donc, il faut vraiment que j'arrêtes de bosser tard

)
Un p'tit coup d'Excel montre que ln() et log10() donnent la même courbe (normale) mais ln() semble plus approprié pour l'ordre de grandeur :
=(LN(A8)-LN($A$2))*2
la formule est le calcul Ln(puissanceCPT1)-Ln(puissanceMin))*Echelle
Et puis voici le code pour rendre service à ceux qui se creusent la tête avec les coordonnées, les échelles et les offsets :
Code : Tout sélectionner
Procedure GraphPowerFile(imageID, cpt)
Protected PLow, PFull, XMax.i, YMax.i
If StartDrawing(ImageOutput(imageID))
XMax.i = ImageWidth(imageID)
OffX.i = 0
EchX.f = XMax/288
YMax.i = ImageHeight(imageID)
If cpt = 2
offsetCpt = 3
PFull = 3000
PLow = 10
Else
offsetCpt = 0
PFull = 13000
PLow = 100
EndIf
Ylogmin.f = Log(Plow)
Ylogmax.f = Log(PFull)
Delta.f = Ylogmax-Ylogmin
EchY.f = YMax/Delta
OffsetY.f = Ylogmin*EchY
Debug "OffsetY "+StrF(offsety)+" YMax "+Str(YMax)+" Delta "+StrF(delta)
afh=220-20
afl=190-20
DrawingMode(#PB_2DDrawing_Gradient)
BackColor(RGB(afl,afl,afh))
FrontColor(RGB(afh,afh,afh))
LinearGradient(0,0,0,Ymax)
Box(0,0,24*12,Ymax)
DrawingMode(#PB_2DDrawing_Default)
; Draw scale (Watt)
For t = PLow To PFull Step 1000
y2 = YMax - Log(t)*EchY.f+OffsetY
r = RGB(240,240,240)
LineXY(0,y2,XMax,y2,r)
Next t
; Draw scale (time hour)
For t= 0 To 24*12 Step 12
LineXY(t,0,t,YMax,RGB(240,240,240))
If Mod(t,36) = 0
LineXY(t,0,t,YMax,RGB(255,255,255))
DrawingFont(FontID(2))
DrawingMode(#PB_2DDrawing_Transparent)
DrawText(t+1,0,Str(t/12),RGB(120,120,120))
DrawingMode(#PB_2DDrawing_Default)
EndIf
Next t
; Draw graph
file$=cheminStats$+FormatDate("%yyyy-%mm-%dd",Date())+"_power.csv"
If OpenFile(#FileTemp, file$)
Debug "Graphing power..."
x1 = 1
Pmoy2=YMax - Log(PLow)*EchY+OffsetY
While Eof(#FileTemp) = 0
a$ = ReadString(#FileTemp)
Pmin.f=YMax - Log(ValF(StringField(a$,offsetCpt+1,";")))*EchY+OffsetY
Pmax.f=YMax - Log(ValF(StringField(a$,offsetCpt+2,";")))*EchY+OffsetY
Pmoy.f=YMax - Log(ValF(StringField(a$,offsetCpt+3,";")))*EchY+OffsetY
If cpt = 1 And Mod(x1,10)=0
Debug StrF(Pmoy,1) + " from " + StringField(a$,offsetCpt+3,";") + " "+Str(PLow)
EndIf
LineXY(x1,Pmin,x1,Pmax,RGB(200,250,200))
LineXY(x1-1,Pmoy2,x1,Pmoy,RGB(0,100,0))
x1 = x1 + 1
Pmoy2=Pmoy
Wend
CloseFile(#FileTemp)
EndIf
DrawingFont(FontID(2))
DrawingMode(#PB_2DDrawing_Transparent)
If x1 > (24*12-40)
xtext = x1-40
Else
xtext = x1
EndIf
If Pmoy < 20
ytext = Log(Pmoy+10)
Else
ytext = Log(Pmoy-10)
EndIf
t$ = Str(Pmoy/EchY)
DrawText(xtext+2,YMax-ytext,t$+"w",RGB(0,0,70))
DrawingMode(#PB_2DDrawing_Default)
EndIf
StopDrawing()
Resultat = SaveImage(imageID,wf$+"CPT"+Str(cpt)+".png",#PB_ImagePlugin_PNG)
EndProcedure