Hello,
I have a small problem,
I would have separated the colors by value and then 2 more layers.
I do not get the data so separated.
Private Sub Cp_Chart(Cg As Single, Cgk As Single)
Dim c As XYChart, Width1, Height1
Width1 = Viewer2.Width / Screen.TwipsPerPixelX
Height1 = Viewer2.Height / Screen.TwipsPerPixelY
Set c = cd.XYChart(Width1, Height1, &HF0F0FF, &H0)
Call c.setPlotArea(40, 30, Width1 - 50, Height1 - 60, &HFFFFFF, -1, -1, &HCCCCCC, &HCCCCCC)
Call c.setClipping '
Dim layer As barLayer, minValue, maxValue, Labels(), data0(), Data1()
Set layer = c.addBarLayer2(cd.Side, 4)
Call c.addTitle(" Analyse Cg und Cgk", "Arial", 9)
Call c.setBorder(cd.Transparent)
Call layer.setAggregateLabelStyle("arialbd.ttf", 8, layer.yZoneColor(0, &HCC3300, &H3333FF))
'Call layer.setBorderColor(cd.Transparent, cd.softLighting(cd.Top))
ReDim Labels(1)
ReDim data0(1)
ReDim Data1(1)
Labels(0) = "Cg"
Labels(1) = "Cgk"
data0(0) = 1.33
data0(1) = 1.33
Data1(0) = Round(Cg, 3)
Data1(1) = Round(Cgk, 3)
Dim Tol As Single
Dim DataColor
'Call c.xAxis().setLabels(Labels)
Dim i%
For i = 0 To UBound(Data1)
If Data1(i) >= 1.33 Then
DataColor = &H9ACD32
Else
DataColor = &HFF8080
End If
Call c.xAxis().addLabel(i, Labels(i)) ???
Call layer.addDataSet(Array(data0(i)), &H80FF80, "Soll") '&HFF8080
Call layer.addDataSet(Array(Data1(i)), DataColor, "Ist")
Next
minValue = 0
maxValue = 1.33 + (Cg / 2)
Tol = (Cgk) / 5
Call c.yAxis().setLinearScale(Round(minValue, 3), Round(maxValue, 3))
'Call c.layout
minValue = c.yAxis().getMinValue()
maxValue = c.yAxis().getMaxValue()
'Call c.addLegend(80, 23, False, "", 8).setBackground(cd.Transparent)
Set Viewer2.Chart = c
End Sub
Guß Helmut
|