Software FX Community

# Line Chart

## Recommended Posts

```Hi,
How do I create SMOOTH and connected line Chart (please refer to
expected.jpg)? For your information, some of the point on certain series has
NULL value and causing the line cannot connect to each other. I  also tried
to use the sample from "Passing Data.vbp" but it cannot help me to solve my
problem. In that sample, you used OpenDataEx COD_VALUES Or COD_REMOVE, 2, 10
and OpenDataEx COD_XVALUES, 2, 10 methods and seem likes you need to fix
same data point for both series. In my case, both series can have different
data point. (Please refer to LineChart2.jpg). If I tried to apply
Series=LINES to red color series, it will generate unwanted chart (please
refer to LineChart3.jpg) that connect each data point to zero value. If I
take out the Zero value (please refer to LineChart4.jpg) then it will not
create smooth and connected Line Chart.
Thanks
Regard,
Chia```
##### Share on other sites

```What you need to do is to create an X/Y chart. This type of chart allows you
to assign X AND Y values to each point hence making it possible to have
points that are not equally spaced.
All series will still have the same number of points but you can move the
HIDDEN points to the end of the series so that they don't disrupt the flow.
For example, the following code will create a picture like the one attached:
Dim i As Integer
Dim n As Integer
With ChartFX1
n = 11
.OpenDataEx COD_VALUES, 2, n
For i = 0 To n - 1
.ValueEx(0, i) = 80
Next i
For i = 0 To n - 1
.ValueEx(1, i) = 40
Next i
.OpenDataEx COD_XVALUES, 2, n
For i = 0 To n - 1
.XValueEx(0, i) = i
Next i
For i = 0 To (n - 1) / 2 ' Second series has only half the points
.XValueEx(1, i) = i * 2
Next i
' Hide remaining points
For i = i To n - 1
.ValueEx(1, i) = CHART_HIDDEN
Next i
.CloseData COD_XVALUES
End With
--
FP
Software FX, Inc.```
##### Share on other sites

```Thanks a lot
"FP" <support@softwarefx.com> wrote in message
news:wWKJLqNLBHA.1072@webserver1.softwarefx.com...
> What you need to do is to create an X/Y chart. This type of chart allows
you
> to assign X AND Y values to each point hence making it possible to have
> points that are not equally spaced.
>
> All series will still have the same number of points but you can move the
> HIDDEN points to the end of the series so that they don't disrupt the
flow.
>
> For example, the following code will create a picture like the one
attached:
>
>     Dim i As Integer
>     Dim n As Integer
>
>     With ChartFX1
>         n = 11
>
>         .OpenDataEx COD_VALUES, 2, n
>         For i = 0 To n - 1
>             .ValueEx(0, i) = 80
>         Next i
>         For i = 0 To n - 1
>             .ValueEx(1, i) = 40
>         Next i
>
>         .OpenDataEx COD_XVALUES, 2, n
>         For i = 0 To n - 1
>             .XValueEx(0, i) = i
>         Next i
>         For i = 0 To (n - 1) / 2 ' Second series has only half the points
>             .XValueEx(1, i) = i * 2
>         Next i
>
>         ' Hide remaining points
>         For i = i To n - 1
>             .ValueEx(1, i) = CHART_HIDDEN
>         Next i
>         .CloseData COD_XVALUES
>     End With
>
> --
> FP
> Software FX, Inc.
>
>
>```

#### Archived

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

×