ASE Home Page Products Download Purchase Support About ASE
ChartDirector General
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  Different symbols on Scatter Chart graph
Posted by Radhika T on Jan-14-2020 04:12
Hi,

We have a requirement as below and I am having trouble how to do it.

We have 4 locations that has different services and not all services are same in 4 locations . User wants to see same symbol for the same service in all locations.

Loc A has : GS, GYN, OPTH, ORAL, U26

Loc B has : GS, GYN, PLA, ORAL, CARD

Loc C has : GS, RAD, SVA, CARD

Loc D has : GS, GYN, OPTH, ORAL, PLA, N20, NSA, STX

The data comes from a database table for each service based on location.
When I query the data, it comes as first come , first serve order.

The graph shows a diamond symbol for GS ( which is good, as it exists in all locations).

For GYN and RAD, the polygon symbol shows on graph.

For OPTH, PLA, SVA shares same symbol, which is a third set.

User wants to see different symbols for GYN and RAD ( and same as with OPTH, PLA, SVA services ).
Since the data comes from database table, how do I control, which service takes which symbol.

Thank you for your time and help.
Radhika

  Re: Different symbols on Scatter Chart graph
Posted by Peter Kwan on Jan-15-2020 00:15
Hi Radhika,

You can use multiple scatter layers, one for each symbol.

There is an example included in ChartDirector as follows:

https://www.advsofteng.com/doc/cdnet.htm#multisymbolline.htm

The example above contains a line chart, with multiple scatter symbols. The line is added with addLineLayer, while the scatter symbols are added with addScatterLayer. For your case, you just do not add the line. The chart then contains just the scatter symbols, which should be what you need.

The example above starts with 3 arrays for the x-coordinates, y-coordinates and the point type. It then generate multiple scatter layers, one for each point type.

Hope this can help.

Regards
Peter Kwan

  Re: Different symbols on Scatter Chart graph
Posted by Radhika T on Jan-15-2020 00:32
Hi Peter,

Thank u for reply.  I have scatter chart created. Below is the code I have where symbols(i) means a set of symbols predefined in code.

Dim i As Integer
        For i = 0 To UBound(labels)
            Dim Layer As ScatterLayer = ch.addScatterLayer(New Double() {usage(i)}, New Double() {util(i)}, "", _
            symbols(i), 15, symbolsColor(i))
            Layer.addExtraField(New String() {labels(i)})
            Layer.setDataLabelFormat("{field0}")
            Dim textbox As ChartDirector.TextBox = Layer.setDataLabelStyle("Arial Bold", 8)
            'textbox.setBackground(&HCC99FF, Chart.Transparent, 1)
            textbox.setAlignment(Chart.Left)
            textbox.setPos(4, 0)
           Next

Can I do something like this,

if service=GS then use Chart.circlesymbol
if service=GYN then use Chart.Polygonshape
  if service ='OPTH then use Chart.Diamondsymbol and so on.

Did not understand how do I incorporate if then else in 3rd line of code above where I am using symbols(i) and symbolscolor(i).

Thank you,
Radhika

  Re: Different symbols on Scatter Chart graph
Posted by Peter Kwan on Jan-15-2020 16:56
Hi Radhika,

I assume you have a services(i) for the service. So you can do:

Dim i As Integer
For i = 0 To UBound(labels)
  Dim symbol As Integer
  if services(i) = "GS" then symbol = Chart.CircleSymbol
  if services(i) = "GYN" then symbol = Chart.Polygonshape
  if services(i) = "OPTH" then symbol = Chart.Diamondsymbol
  '.... and so on ....

  Dim Layer As ScatterLayer = ch.addScatterLayer(New Double() {usage(i)}, New
  Double() {util(i)}, "", _
      symbol, 15, symbolsColor(i))

   ......

Next

Hope this can help.

Regards
Peter Kwan