Jump to content
Software FX Community

Special LineChart


IT Support

Recommended Posts

Posted

Hello

We are using ChartFX Client Server 5.1, integrated in Active Reports.

Is the attached kind of linechart possible at all? there are two values at the same position on the x-axis.

Thanks for your help.

Regards

Luzia Baumgartner

Posted

Yes. You can achieve this chart using a Line chart and supplying X-Values.

XValues can be supplied either through DataBinding (see DataType property) or using the API (see XValue property).

 

Posted

If I only use the y-Values, my linechart is okay (see Pic 1). As soon as I use the OpenDataEx for XValues I only have one x-Point left... (see Pic 2)

What am I doing wrong?

This is a part of my code:

.OpenDataEx CHARTFX_COD_VALUES,1,5

.OpenDataEx CHARTFX_COD_XVALUES,1,5

iRow = 0

do until rs.eof

.Series(0).YValue(iRow) = ChartValue("" & rs("prValue1").Value)

' if "" & rs("prValue2").Value <> "" then

' .Series(0).XValue(iRow) = ChartValue("" & rs("prValue2").Value)

' else

' .Series(0).XValue(iRow) = ChartValue("" & rs("prValue1").Value)

' end if

iRow = iRow + 1

rs.MoveNext

if rs.EOF then exit do

loop

.Axis(CHARTFX_AXIS_Y).Max = 0.1

.Axis(CHARTFX_AXIS_Y).Min = 0.05

.Axis(CHARTFX_AXIS_Y).Step = 0.005

.CloseData CHARTFX_COD_VALUES

.CloseData CHARTFX_COD_XVALUES

Posted

when I uncomment those 5 lines in my code, the chart comes out as follows. Only the rows 1 and 4 should have such a xvalue. Why does my chart have only one point on the x-axis?

here is my resultset. note that rows 2, 3 and 5 don't have a value in the second column.

 

Posted

Looks like your X-Values are all less than 1.

Since you are not displaying any decimals in the X-Axis this is what you get.

 To set the number of decimals in the X-Axis:

chart.Axis(AXIS_X).Decimals = 2;

Posted

I changed the initializing of the chart, I make it manually now instead of using the template. The values are multiplied by 100 now, so you can see that the ordinary line is ok. But the thing with the xvalues doesn't work yet! there is no difference in the chart wether I set them or not.

Sub OnFormat

set rs = RecordSet()

if rs.EOF then exit sub

with rpt.Sections("PageHeader").Controls("ChartFX1")

'initialze chart

.ToolBar =

False

.PaletteBar =

False

.MenuBar =

False

.PatternBar =

False

.DataEditor =

False

.Border =

False

.BorderStyle = 0

.ClearData 1

iRow = 0

.OpenDataEx CHARTFX_COD_VALUES,1,iRow + 1

.OpenDataEx CHARTFX_COD_XVALUES,1,iRow + 1

do until rs.eof

.Series(0).YValue(iRow) = ChartValue("" & rs("prValue1").Value)

.Axis(CHARTFX_AXIS_X).Label(iRow) = "" & rs("txValue").Value

if "" & rs("prValue2").Value <> "" then

.Series(0).XValue(iRow) = ChartValue("" & rs("prValue2").Value)

else

.Series(0).XValue(iRow) = ChartValue("" & rs("prValue1").Value)

end if

iRow = iRow + 1

rs.MoveNext

if rs.EOF then exit do

loop

.CloseData CHARTFX_COD_VALUES

.CloseData CHARTFX_COD_XVALUES

.Series(0).Gallery = 1

'Line

.Chart3D =

False

.RGB2DBk = RGB(255,255,255)

.RGBBk = RGB(255,255,255)

.Grid = 1

'Horizontal

.Axis(CHARTFX_AXIS_Y).Max = 8

.Axis(CHARTFX_AXIS_Y).Min = 5

.Axis(CHARTFX_AXIS_Y).Step = 0.5

.Axis(CHARTFX_AXIS_Y).Decimals = 2

.Axis(CHARTFX_AXIS_X).Decimals = 2

end with

rs.movefirst

End

Sub

 

  • 1 month later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...