Jump to content
Software FX Community

Legend Two - the sequel


User (Legacy)

Recommended Posts

Lets try again .....

I have an application in which I receive up to 5 arrays (A1(), A2(),

A3(),etc., up to 5 names N1, N2 etc..the number of series to graph, the min

and the max.

I take the data from the arrays and put the data in a datatable. Each column

holds a series of data.

The line graph is perfect except for the fact that the legend includes not

only a color indicator and name of the series which I want - but also a list

of names of the data points as illustrated below:

1: value#1

2: value#2

3: value#3

4: value#4

Etc...

which I don't. Any ideas? Code below

Public Sub CreateInvestGraph(ByVal A1() As Decimal, ByVal A2() As Decimal,

ByVal A3() As Decimal, ByVal A4() As Decimal, ByVal A5() As Decimal, ByVal

N1 As String, ByVal N2 As String, ByVal N3 As String, ByVal N4 As String,

ByVal N5 As String, ByVal NumSec As Integer, ByVal min As Double, ByVal max

As Double)

Dim mydatatable As New DataTable()

'Add Colums

mydatatable.Columns.Add("col1", GetType(Decimal))

If NumSec > 4 Then

mydatatable.Columns.Add("col2", GetType(Decimal))

mydatatable.Columns.Add("col3", GetType(Decimal))

mydatatable.Columns.Add("col4",

GetType(Decimal))mydatatable.Columns.Add("col5", GetType(Decimal))

ElseIf NumSec > 3 Then

mydatatable.Columns.Add("col2",

GetType(Decimal))mydatatable.Columns.Add("col3",

GetType(Decimal))mydatatable.Columns.Add("col4", GetType(Decimal))

ElseIf NumSec > 2 Then

mydatatable.Columns.Add("col2",

GetType(Decimal))mydatatable.Columns.Add("col3", GetType(Decimal))

ElseIf NumSec > 1 Then

mydatatable.Columns.Add("col2", GetType(Decimal))

End If

'Add rows to the datatable

Dim X As Integer

For X = 0 To A1.Length - 1

Dim A As DataRow = mydatatable.NewRow

A("col1") = A1(X)

If NumSec > 4 Then

A("col2") = A2(X)

A("col3") = A3(X)

A("col4") = A4(X)

A("col5") = A5(X)

ElseIf NumSec > 3 Then

A("col2") = A2(X)

A("col3") = A3(X)

A("col4") = A4(X)

ElseIf NumSec > 2 Then

A("col2") = A2(X)

A("col3") = A3(X)

ElseIf NumSec > 1 Then

A("col2") = A2(X)

End If

mydatatable.Rows.Add(A)

Next X

'Specify Chart Particulars

ChartInvest.DataSource = mydatatable

ChartInvest.LegendBox = True

ChartInvest.AxisY.Min = min

ChartInvest.AxisY.Max = max

ChartInvest.AxisX.ClearLabels()

ChartInvest.AxisX.Min = 0

ChartInvest.AxisX.Max = A1.Length - 1

ChartInvest.AxisX.Visible = False

ChartInvest.AxisY.LabelsFormat.Format =

SoftwareFX.ChartFX.Lite.AxisFormat.Currency

ChartInvest.AxisX.LabelsFormat.Format =

SoftwareFX.ChartFX.Lite.AxisFormat.Number

ChartInvest.Series(0).Gallery = SoftwareFX.ChartFX.Lite.Gallery.Lines

ChartInvest.Series(0).Color = Aqua

ChartInvest.Series(1).Gallery = SoftwareFX.ChartFX.Lite.Gallery.Lines

ChartInvest.Series(1).Color = Green

ChartInvest.Series(2).Gallery = SoftwareFX.ChartFX.Lite.Gallery.Lines

ChartInvest.Series(2).Color = Red

ChartInvest.Series(3).Gallery = SoftwareFX.ChartFX.Lite.Gallery.Lines

ChartInvest.Series(3).Color = Purple

ChartInvest.Series(4).Gallery = SoftwareFX.ChartFX.Lite.Gallery.Lines

ChartInvest.Series(4).Color = LightSalmon

ChartInvest.Titles(0).Text = "Price History"

ChartInvest.Titles(0).TextColor = Red

ChartInvest.SerLeg(0) = N1

If NumSec > 4 Then

ChartInvest.SerLeg(1) = N2

ChartInvest.SerLeg(2) = N3

ChartInvest.SerLeg(3) = N4

ChartInvest.SerLeg(4) = N5

ElseIf NumSec > 3 Then

ChartInvest.SerLeg(1) = N2

ChartInvest.SerLeg(2) = N3

ChartInvest.SerLeg(3) = N4

ElseIf NumSec > 2 Then

ChartInvest.SerLeg(1) = N2

ChartInvest.SerLeg(2) = N3

ElseIf NumSec > 1 Then

ChartInvest.SerLeg(1) = N2

End If

ChartInvest.SerLegBox = True

Link to comment
Share on other sites

Lets try again .....

I have an application in which I receive up to 5 arrays (A1(), A2(),

A3(),etc., up to 5 names N1, N2 etc..the number of series to graph, the min

and the max.

I take the data from the arrays and put the data in a datatable. Each column

holds a series of data.

The line graph is perfect except for the fact that the legend includes not

only a color indicator and name of the series which I want - but also a list

of names of the data points as illustrated below:

1: value#1

2: value#2

3: value#3

4: value#4

Etc...

which I don't. Any ideas? Code below

Public Sub CreateInvestGraph(ByVal A1() As Decimal, ByVal A2() As Decimal,

ByVal A3() As Decimal, ByVal A4() As Decimal, ByVal A5() As Decimal, ByVal

N1 As String, ByVal N2 As String, ByVal N3 As String, ByVal N4 As String,

ByVal N5 As String, ByVal NumSec As Integer, ByVal min As Double, ByVal max

As Double)

Dim mydatatable As New DataTable()

'Add Colums

mydatatable.Columns.Add("col1", GetType(Decimal))

If NumSec > 4 Then

mydatatable.Columns.Add("col2", GetType(Decimal))

mydatatable.Columns.Add("col3", GetType(Decimal))

mydatatable.Columns.Add("col4",

GetType(Decimal))mydatatable.Columns.Add("col5", GetType(Decimal))

ElseIf NumSec > 3 Then

mydatatable.Columns.Add("col2",

GetType(Decimal))mydatatable.Columns.Add("col3",

GetType(Decimal))mydatatable.Columns.Add("col4", GetType(Decimal))

ElseIf NumSec > 2 Then

mydatatable.Columns.Add("col2",

GetType(Decimal))mydatatable.Columns.Add("col3", GetType(Decimal))

ElseIf NumSec > 1 Then

mydatatable.Columns.Add("col2", GetType(Decimal))

End If

'Add rows to the datatable

Dim X As Integer

For X = 0 To A1.Length - 1

Dim A As DataRow = mydatatable.NewRow

A("col1") = A1(X)

If NumSec > 4 Then

A("col2") = A2(X)

A("col3") = A3(X)

A("col4") = A4(X)

A("col5") = A5(X)

ElseIf NumSec > 3 Then

A("col2") = A2(X)

A("col3") = A3(X)

A("col4") = A4(X)

ElseIf NumSec > 2 Then

A("col2") = A2(X)

A("col3") = A3(X)

ElseIf NumSec > 1 Then

A("col2") = A2(X)

End If

mydatatable.Rows.Add(A)

Next X

'Specify Chart Particulars

ChartInvest.DataSource = mydatatable

ChartInvest.LegendBox = True

ChartInvest.AxisY.Min = min

ChartInvest.AxisY.Max = max

ChartInvest.AxisX.ClearLabels()

ChartInvest.AxisX.Min = 0

ChartInvest.AxisX.Max = A1.Length - 1

ChartInvest.AxisX.Visible = False

ChartInvest.AxisY.LabelsFormat.Format =

SoftwareFX.ChartFX.Lite.AxisFormat.Currency

ChartInvest.AxisX.LabelsFormat.Format =

SoftwareFX.ChartFX.Lite.AxisFormat.Number

ChartInvest.Series(0).Gallery = SoftwareFX.ChartFX.Lite.Gallery.Lines

ChartInvest.Series(0).Color = Aqua

ChartInvest.Series(1).Gallery = SoftwareFX.ChartFX.Lite.Gallery.Lines

ChartInvest.Series(1).Color = Green

ChartInvest.Series(2).Gallery = SoftwareFX.ChartFX.Lite.Gallery.Lines

ChartInvest.Series(2).Color = Red

ChartInvest.Series(3).Gallery = SoftwareFX.ChartFX.Lite.Gallery.Lines

ChartInvest.Series(3).Color = Purple

ChartInvest.Series(4).Gallery = SoftwareFX.ChartFX.Lite.Gallery.Lines

ChartInvest.Series(4).Color = LightSalmon

ChartInvest.Titles(0).Text = "Price History"

ChartInvest.Titles(0).TextColor = Red

ChartInvest.SerLeg(0) = N1

If NumSec > 4 Then

ChartInvest.SerLeg(1) = N2

ChartInvest.SerLeg(2) = N3

ChartInvest.SerLeg(3) = N4

ChartInvest.SerLeg(4) = N5

ElseIf NumSec > 3 Then

ChartInvest.SerLeg(1) = N2

ChartInvest.SerLeg(2) = N3

ChartInvest.SerLeg(3) = N4

ElseIf NumSec > 2 Then

ChartInvest.SerLeg(1) = N2

ChartInvest.SerLeg(2) = N3

ElseIf NumSec > 1 Then

ChartInvest.SerLeg(1) = N2

End If

ChartInvest.SerLegBox = True

Link to comment
Share on other sites

You are showing both the Legendbox and the SerLegBox. Remove the line

ChartInvest.LegendBox = True

GA

Software FX

"Stuart Veale" <stu@invest-perform.com> wrote in message

news:srVSN3wADHA.3076@webserver1.softwarefx.com...

> Lets try again .....

>

> I have an application in which I receive up to 5 arrays (A1(), A2(),

> A3(),etc., up to 5 names N1, N2 etc..the number of series to graph, the

min

> and the max.

>

> I take the data from the arrays and put the data in a datatable. Each

column

> holds a series of data.

>

> The line graph is perfect except for the fact that the legend includes not

> only a color indicator and name of the series which I want - but also a

list

> of names of the data points as illustrated below:

>

> 1: value#1

> 2: value#2

> 3: value#3

> 4: value#4

> Etc...

>

> which I don't. Any ideas? Code below

>

> Public Sub CreateInvestGraph(ByVal A1() As Decimal, ByVal A2() As Decimal,

> ByVal A3() As Decimal, ByVal A4() As Decimal, ByVal A5() As Decimal, ByVal

> N1 As String, ByVal N2 As String, ByVal N3 As String, ByVal N4 As String,

> ByVal N5 As String, ByVal NumSec As Integer, ByVal min As Double, ByVal

max

> As Double)

>

>

>

> Dim mydatatable As New DataTable()

>

> 'Add Colums

> mydatatable.Columns.Add("col1", GetType(Decimal))

>

> If NumSec > 4 Then

> mydatatable.Columns.Add("col2", GetType(Decimal))

> mydatatable.Columns.Add("col3", GetType(Decimal))

> mydatatable.Columns.Add("col4",

> GetType(Decimal))mydatatable.Columns.Add("col5", GetType(Decimal))

> ElseIf NumSec > 3 Then

> mydatatable.Columns.Add("col2",

> GetType(Decimal))mydatatable.Columns.Add("col3",

> GetType(Decimal))mydatatable.Columns.Add("col4", GetType(Decimal))

> ElseIf NumSec > 2 Then

> mydatatable.Columns.Add("col2",

> GetType(Decimal))mydatatable.Columns.Add("col3", GetType(Decimal))

> ElseIf NumSec > 1 Then

> mydatatable.Columns.Add("col2", GetType(Decimal))

> End If

>

> 'Add rows to the datatable

> Dim X As Integer

> For X = 0 To A1.Length - 1

> Dim A As DataRow = mydatatable.NewRow

> A("col1") = A1(X)

> If NumSec > 4 Then

> A("col2") = A2(X)

> A("col3") = A3(X)

> A("col4") = A4(X)

> A("col5") = A5(X)

> ElseIf NumSec > 3 Then

> A("col2") = A2(X)

> A("col3") = A3(X)

> A("col4") = A4(X)

> ElseIf NumSec > 2 Then

> A("col2") = A2(X)

> A("col3") = A3(X)

> ElseIf NumSec > 1 Then

> A("col2") = A2(X)

> End If

> mydatatable.Rows.Add(A)

> Next X

>

> 'Specify Chart Particulars

> ChartInvest.DataSource = mydatatable

> ChartInvest.LegendBox = True

> ChartInvest.AxisY.Min = min

> ChartInvest.AxisY.Max = max

> ChartInvest.AxisX.ClearLabels()

> ChartInvest.AxisX.Min = 0

> ChartInvest.AxisX.Max = A1.Length - 1

> ChartInvest.AxisX.Visible = False

> ChartInvest.AxisY.LabelsFormat.Format =

> SoftwareFX.ChartFX.Lite.AxisFormat.Currency

> ChartInvest.AxisX.LabelsFormat.Format =

> SoftwareFX.ChartFX.Lite.AxisFormat.Number

>

> ChartInvest.Series(0).Gallery = SoftwareFX.ChartFX.Lite.Gallery.Lines

> ChartInvest.Series(0).Color = Aqua

> ChartInvest.Series(1).Gallery = SoftwareFX.ChartFX.Lite.Gallery.Lines

> ChartInvest.Series(1).Color = Green

> ChartInvest.Series(2).Gallery = SoftwareFX.ChartFX.Lite.Gallery.Lines

> ChartInvest.Series(2).Color = Red

> ChartInvest.Series(3).Gallery = SoftwareFX.ChartFX.Lite.Gallery.Lines

> ChartInvest.Series(3).Color = Purple

> ChartInvest.Series(4).Gallery = SoftwareFX.ChartFX.Lite.Gallery.Lines

> ChartInvest.Series(4).Color = LightSalmon

> ChartInvest.Titles(0).Text = "Price History"

> ChartInvest.Titles(0).TextColor = Red

> ChartInvest.SerLeg(0) = N1

>

> If NumSec > 4 Then

> ChartInvest.SerLeg(1) = N2

> ChartInvest.SerLeg(2) = N3

> ChartInvest.SerLeg(3) = N4

> ChartInvest.SerLeg(4) = N5

> ElseIf NumSec > 3 Then

> ChartInvest.SerLeg(1) = N2

> ChartInvest.SerLeg(2) = N3

> ChartInvest.SerLeg(3) = N4

> ElseIf NumSec > 2 Then

> ChartInvest.SerLeg(1) = N2

> ChartInvest.SerLeg(2) = N3

> ElseIf NumSec > 1 Then

> ChartInvest.SerLeg(1) = N2

> End If

> ChartInvest.SerLegBox = True

>

>

>

>

>

Link to comment
Share on other sites

You are showing both the Legendbox and the SerLegBox. Remove the line

ChartInvest.LegendBox = True

GA

Software FX

"Stuart Veale" <stu@invest-perform.com> wrote in message

news:srVSN3wADHA.3076@webserver1.softwarefx.com...

> Lets try again .....

>

> I have an application in which I receive up to 5 arrays (A1(), A2(),

> A3(),etc., up to 5 names N1, N2 etc..the number of series to graph, the

min

> and the max.

>

> I take the data from the arrays and put the data in a datatable. Each

column

> holds a series of data.

>

> The line graph is perfect except for the fact that the legend includes not

> only a color indicator and name of the series which I want - but also a

list

> of names of the data points as illustrated below:

>

> 1: value#1

> 2: value#2

> 3: value#3

> 4: value#4

> Etc...

>

> which I don't. Any ideas? Code below

>

> Public Sub CreateInvestGraph(ByVal A1() As Decimal, ByVal A2() As Decimal,

> ByVal A3() As Decimal, ByVal A4() As Decimal, ByVal A5() As Decimal, ByVal

> N1 As String, ByVal N2 As String, ByVal N3 As String, ByVal N4 As String,

> ByVal N5 As String, ByVal NumSec As Integer, ByVal min As Double, ByVal

max

> As Double)

>

>

>

> Dim mydatatable As New DataTable()

>

> 'Add Colums

> mydatatable.Columns.Add("col1", GetType(Decimal))

>

> If NumSec > 4 Then

> mydatatable.Columns.Add("col2", GetType(Decimal))

> mydatatable.Columns.Add("col3", GetType(Decimal))

> mydatatable.Columns.Add("col4",

> GetType(Decimal))mydatatable.Columns.Add("col5", GetType(Decimal))

> ElseIf NumSec > 3 Then

> mydatatable.Columns.Add("col2",

> GetType(Decimal))mydatatable.Columns.Add("col3",

> GetType(Decimal))mydatatable.Columns.Add("col4", GetType(Decimal))

> ElseIf NumSec > 2 Then

> mydatatable.Columns.Add("col2",

> GetType(Decimal))mydatatable.Columns.Add("col3", GetType(Decimal))

> ElseIf NumSec > 1 Then

> mydatatable.Columns.Add("col2", GetType(Decimal))

> End If

>

> 'Add rows to the datatable

> Dim X As Integer

> For X = 0 To A1.Length - 1

> Dim A As DataRow = mydatatable.NewRow

> A("col1") = A1(X)

> If NumSec > 4 Then

> A("col2") = A2(X)

> A("col3") = A3(X)

> A("col4") = A4(X)

> A("col5") = A5(X)

> ElseIf NumSec > 3 Then

> A("col2") = A2(X)

> A("col3") = A3(X)

> A("col4") = A4(X)

> ElseIf NumSec > 2 Then

> A("col2") = A2(X)

> A("col3") = A3(X)

> ElseIf NumSec > 1 Then

> A("col2") = A2(X)

> End If

> mydatatable.Rows.Add(A)

> Next X

>

> 'Specify Chart Particulars

> ChartInvest.DataSource = mydatatable

> ChartInvest.LegendBox = True

> ChartInvest.AxisY.Min = min

> ChartInvest.AxisY.Max = max

> ChartInvest.AxisX.ClearLabels()

> ChartInvest.AxisX.Min = 0

> ChartInvest.AxisX.Max = A1.Length - 1

> ChartInvest.AxisX.Visible = False

> ChartInvest.AxisY.LabelsFormat.Format =

> SoftwareFX.ChartFX.Lite.AxisFormat.Currency

> ChartInvest.AxisX.LabelsFormat.Format =

> SoftwareFX.ChartFX.Lite.AxisFormat.Number

>

> ChartInvest.Series(0).Gallery = SoftwareFX.ChartFX.Lite.Gallery.Lines

> ChartInvest.Series(0).Color = Aqua

> ChartInvest.Series(1).Gallery = SoftwareFX.ChartFX.Lite.Gallery.Lines

> ChartInvest.Series(1).Color = Green

> ChartInvest.Series(2).Gallery = SoftwareFX.ChartFX.Lite.Gallery.Lines

> ChartInvest.Series(2).Color = Red

> ChartInvest.Series(3).Gallery = SoftwareFX.ChartFX.Lite.Gallery.Lines

> ChartInvest.Series(3).Color = Purple

> ChartInvest.Series(4).Gallery = SoftwareFX.ChartFX.Lite.Gallery.Lines

> ChartInvest.Series(4).Color = LightSalmon

> ChartInvest.Titles(0).Text = "Price History"

> ChartInvest.Titles(0).TextColor = Red

> ChartInvest.SerLeg(0) = N1

>

> If NumSec > 4 Then

> ChartInvest.SerLeg(1) = N2

> ChartInvest.SerLeg(2) = N3

> ChartInvest.SerLeg(3) = N4

> ChartInvest.SerLeg(4) = N5

> ElseIf NumSec > 3 Then

> ChartInvest.SerLeg(1) = N2

> ChartInvest.SerLeg(2) = N3

> ChartInvest.SerLeg(3) = N4

> ElseIf NumSec > 2 Then

> ChartInvest.SerLeg(1) = N2

> ChartInvest.SerLeg(2) = N3

> ElseIf NumSec > 1 Then

> ChartInvest.SerLeg(1) = N2

> End If

> ChartInvest.SerLegBox = True

>

>

>

>

>

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...