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

Message ListMessage List     Post MessagePost Message

  Response is not good for stacked area and Area Chart
Posted by nitesh on Mar-27-2018 14:37
Hi,

I am using ViewPortControl for plot graph and its work perfectly for line graph. But when i plot same graph with stacked area or area chart, Response is very poor. Sometimes graph is not plotted and says not responsive. Why ??

For Stacked Area i am using-

Set layer = c.addAreaLayer2(cd.Stack)
Call layer.setGapColor(cd.Transparent)


For Line Graph i am using-

Set layer = c.addLineLayer()
Call layer.setGapColor(cd.Transparent)


I am waiting for your reply.

Thanks & Regards
Nitesh Mathur

  Re: Response is not good for stacked area and Area Chart
Posted by Peter Kwan on Mar-28-2018 03:38
Hi nitesh,

I have just tried myself. I started with the "Zooming and Scrolling with Viewport Control (Web)" sample code, and modified the lines:

    Set layer = c.addLineLayer2()
    Call layer.setFastLineMode()

to:

    Set layer = c.addAreaLayer2(cd.Stack)

and in my case, the sample code works normally.

For your case, are there a very large number of data points? For lines, ChartDirector has a "fast line mode", that makes plotting millions of points fast. But there is no such mode are the area layer.

If the line layer works, one method to create the area layer is to just use a line layer, and then use an "InterLineLayer" to fill the region between the line layer and the x-axis. This will be the same as a 2D area chart.

For stacked area chart, you would need to compute the "stacked line" with your own code, then use multiple InterLineLayer to fill the regions between the stacked lines. It is like:

stackedArea = dataSeriesA
Call layer.addDataSet(stackedArea, ....)
' fill between the line and the x-axis
Call c.addInterLineLayer(c.yAxis().addMark(-9999, cd.Transparent).getLine(), layer.getLine(0), .....)

stackedArea = cd.ArrayMath(stackedArea).add(dataSeriesB).result()
Call layer.addDataSet(stackedArea, ....)
' fill between two lines
Call c.addInterLineLayer(layer.getLine(0), layer.getLine(1), ....)

stackedArea = cd.ArrayMath(stackedArea).add(dataSeriesC).result()
Call layer.addDataSet(stackedArea, ....)
' fill between two lines
Call c.addInterLineLayer(layer.getLine(1), layer.getLine(2), ....)

Regards
Peter Kwan

  Re: Response is not good for stacked area and Area Chart
Posted by Nitesh on Mar-28-2018 18:46
Thanks Peter. It's working perfectly for Stacked Area.

But how can i resolve same problem for Area chart ??

Also For Area chart performance is not good.

Thanks & Regards
Nitesh

  Re: Response is not good for stacked area and Area Chart
Posted by Peter Kwan on Mar-29-2018 03:18
Hi Nitesh,

You mentioned that "It's working perfectly for Stacked Area.". But you also mentioned "But how can i resolve same problem for Area chart ??". I do not quite understand your question. The "Stacked Area" chart is also an Area chart. In your own code as shown in your last message, which is "Set layer = c.addAreaLayer2(cd.Stack)", it shows you are using a stacked area chart. So are you using a stacked area chart, and is it working? If you are using a stacked area chart, and "It's working perfectly for Stacked Area.", is it possible to clarify what is the issue?

Also, in your previous message, you mentioned you are using the ViewPortControl. Are you using the ViewPortControl with a stacked area chart? How many data points you have? Are you using the "addAreaLayer" to create the area chart, or are you using the "addInterLineLayer"? Have you tried to remove the line setGapColor? Are your code using getHTMLImageMap?

If you web page is accessible from the Internet, may be you can provide me with a URL, so I can go in to have a look. If not, may be you can provide a screenshot or the charting part of your code, so I can determine how your chart is configured. You may email me at pkwan@advsofteng.net


Regards
Peter Kwan

  Re: Response is not good for stacked area and Area Chart
Posted by Nitesh on Mar-29-2018 16:20
Hi Peter,

I mentioned it's working perfectly with viewportcontrol for stacked area but not for area chart. Area chart means 3D view.

according to your suggestion I am using addInterLineLayer for plot stacked area graph and its working perfectly same as line graph.

For Area chart i am using-

for i= uBound(legendArray) to 0 step -1
    if graphStyle = 5 then
       Set layer = c.addAreaLayer(baseDataArray(i), eval("&H80"  & Hex(baseColorArray(i
                        mod 50))), legendArray(i))
         if Size3D >=  60 then
              Call layer.set3D(1,1)
         else
              Call layer.set3D(2,10)
         end if
              Call layer.setGapColor(CD.Transparent)
              Call layer.setXData(timeArray)
    else
              Call layer.addDataSet(baseDataArray(i), eval("&H" & Session("LightColorHex")  &
              Hex(baseColorArray(i mod 50))), legendArray(i))
    end if
            call layer.setBorderColor(getChartBorderColor(Hex(baseColorArray(i mod 50))),
            cd.barLighting(0.95, 0.75))
next


Thanks & Regards
Nitesh

  Re: Response is not good for stacked area and Area Chart
Posted by Peter Kwan on Mar-30-2018 01:50
Hi Nitesh,

I do not know how many data points or layers you have. I just suspect it is simply because there are too many points for the area layers.

Unlike the line layer that can handle millions of points, the area layer does not have a "fast mode". Furthermore, plotting 3D charts is slower than 2D charts. So if there are a lot of layers (eg. 100 layers), with a lot of data points in each layer, and all layers are in 3D, it may become slow.

I notice your 3D layers are very thin (1 or 2 pixels thick). If your intention is to plot thin area layers with gaps in between, you can use the addInterLineLayer method for the area layer, then add an empty layer as the gap. In this way, you can take advantage of the "fast line mode". It is like:

Set bottomMark = c.yAxis().addMark(-99999, -1)

for i= uBound(legendArray) to 0 step -1
   Set layer = c.addLineLayer(baseDataArray(i), lineColor(i), legendArray(i))
   Call layer.setXData(timeStamps)
   Call c.addInterLineLayer(bottomMark.getLine(), layer.getLine(), fillColor(i))

   'An empty layer as the 3D gap
   Call c.addLineLayer2().set3D(2)
next

If you want a slightly thicker layer (eg. 2 pixels thick), you may try to emulate it using the line width of the line layer.

Regards
Peter Kwan