CGDevTools Forum

Welcome to the Official CGDevTools Support Community Forums.

Line and bar series on one chart

by XenoG » 12 Dec 2017 20:59

Has anyone created a chart with both bar and line series overlaying each other?

I have the SeriesDefaults Renderer set to jqprBarRenderer. I load the series' data using json arrays to JQPlotData.

I then try to set some of my series to lines using the following code, but it doesn't work. All the series are shown as bars.

TIWCGJQPlotOptionsSeriesDefaults* lineSeries = StaffingIWCGJQPlot->JQPlotOptions->Series->Add();
lineSeries->Renderer = jqprLineRenderer;

Any ideas?

Thanks,

Richard
XenoG
 
Posts: 36
Joined: 15 Nov 2016 15:04

by Jorge Sousa » 13 Dec 2017 11:23

hi

please post a test case demo
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58

by XenoG » 13 Dec 2017 21:28

Hi Jorge,

Whilst making a demo application to send to you, I accidentally found a solution. If you set the SeriesDefaults.Renderer := jqprBarRenderer at design time and then dynamically add 2 new series at run time (mySeries1.Renderer := jqprLineRenderer and mySeries2.Renderer := jqprBarRenderer), the chart will show only bars :cry:

However, if you set the SeriesDefaults.Renderer := jqprLineRenderer at design time and then dynamically add 2 new series at run time (mySeries1.Renderer := jqprLineRenderer and mySeries2.Renderer := jqprBarRenderer), the chart will show both the bars and lines :D

I guess this is a feature of JQPlot and not the fault of IWCGJQPlot.

While I'm here, could I ask a related question. When I change the IWCGJQPlot SeriesDefaults.Renderer at design time, the RendererOptions change depending on the type of Renderer chosen. How can I change the variables in the RendererOptions at run time for both line and bar types? Is there an object that provides access to the relevant variables?

Thanks again for all your help.

Richard
XenoG
 
Posts: 36
Joined: 15 Nov 2016 15:04

by Jorge Sousa » 14 Dec 2017 11:13

Hi Richard

When we speak about IW apps, i'm always afraid when users use the term "dynamic"

Because in Windows dynamic always means "runtime", but in IW Apps can be in the context of a full submit or an ajax event, and these are two very different processes, the first is for the formation of the html page, where everything works, the second one is a pascal to javascript translation that is not always supported.

So my question, are all that dynamic code in a context of a full submit or an ajax (async) event?
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58

by XenoG » 14 Dec 2017 13:30

Hi Jorge,

My fault for using the word dynamic. I should have stuck with design-time and run-time. In Delphi's Object Inspector at design-time I can set the IWCGJQPlot's JQPlotOptions.SeriesDefaults.RendererOptions, e,g, when using a jqprLineRenderer I can set the Smooth property, or when using a jqprBarRenderer I can set the BarDirection property The Object Inspector re configures itself to show me the relevant RendererOptions based on the JQPlotOptions.SeriesDefaults.Renderer type currently selected.

I'm interested in how I access the properties of mySeries.RendererOptions, such as Smooth or BarDirection, at run-time. I've never before used a component that has different properties available based on the value of another property, so I'm sure that it is a lack of experience on my part that is stopping me from understanding how to change these properties at run-time.

In answer to your question, I make changes to the IWCGJQPlot object at run-time (such as changing the series' labels) and then perform a full submit (RenderRegionAsync) to see the changes in the browser. I don't use an Ajax events.

Thanks for all the time you a spending on teaching me how to use your product. I'm really impressed with the CGDevTools software. I never thought I could make such a cool website in my favourite compiler (C++ Builder).

Richard
XenoG
 
Posts: 36
Joined: 15 Nov 2016 15:04

by Jorge Sousa » 14 Dec 2017 18:28

hi Richard

It's normal to make confusion between full submit and ajax, when there is very few documentation

Please try to find the difference between a full submit post, where you the whole page being rendered and an ajax event, because you can only call RenderRegionAsync or ,AjaxReRender in an ajax event, and these methods aren't not exactly full submits, but cgdevtools techniques to render partial zones of the page.

If you want send as a test case demo of what you're doing so that we can analyze and optimize your code.
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58

by XenoG » 14 Dec 2017 19:35

Hi Jorge,

My original problem has been solved (by changing the IWCGJQPlot.JQPlotOptions.SeriesDefaults.Renderer to jqprLineRenderer). This allows me to view a chart with a combination of bars and lines visible at the same time.

I have no problems with the full submit or ajax, as I always make a full submit (RenderRegionAsync) after changing the chart.

My current problem is how to change some features of the series at run-time. For example, how would i change the property mySeries.RendererOptions.Smooth. In the Delphi designer (Object Inspector) it is easy to change this property, but at run-time I cannot see how to change this.

Thanks,

Richard
XenoG
 
Posts: 36
Joined: 15 Nov 2016 15:04

by Jorge Sousa » 15 Dec 2017 10:45

Hello

I have no problems with the full submit or ajax, as I always make a full submit (RenderRegionAsync) after changing the chart.


Ok, but what is called "full submit" is a full html page rerender, like a TIWButton.OnClick for instance

For example, how would i change the property mySeries.RendererOptions.Smooth. In the Delphi designer (Object Inspector) it is easy to change this property, but at run-time I cannot see how to change this.


TIWCGJQPlot->JQPlotOptions->Series it's a TCollection property

you will have to get a TCollectionItem, for instance: TIWCGJQPlot->JQPlotOptions->Series[0]->RendererOptions->Smooth
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58

by XenoG » 15 Dec 2017 13:16

Hi Jorge.

Yes. I make the user click a button which populates the IWCGJQPlot and then renders the entire region with the plot in it. This bit is working fine. No problems.

I've no experience of TCollection objects, so apologies if I am missing something simple (I find TList does everything I need in C++).

When I create my own series at runtime, I find that lineSeries->RendererOptions->Collection is equal to NULL, so there is nothing here for me. e.g.
TIWCGJQPlotOptionsSeriesDefaults* lineSeries = OccupancyIWCGJQPlot->JQPlotOptions->Series->Add();
lineSeries->Label_ = locationReportData->LocationName;
lineSeries->Renderer = jqprLineRenderer;

if I try to use lineSeries->RendererOptions->Collection, it is NULL.

I have noticed that the properties I want to access are probably in the following list

lineSeries->RendererOptions->MemberList

However, this list is not accessible by property name or function ( lineSeries->RendererOptions->GetMemberList(); )

I can see that the list contains the correct number of items for a jqprLineRenderer series {HightlightColour, HighlightMouseDown, HighlightMouseOver and Smooth). When I change the Renderer to jqprBarRenderer, the MembersList contains 20 items, so I am sure this is the list of items that I want to edit.

Is there any way to access the items in lineSeries->RendererOptions->MemberList? Or is there another way (Collections?) that I do not understand?

Thanks again for all your help.

Richard
XenoG
 
Posts: 36
Joined: 15 Nov 2016 15:04

by Jorge Sousa » 15 Dec 2017 15:43

Hi Richard

Depending on the value that you set for lineSeries->Renderer you have the RenderedOptions several classes

- jqprBarRenderer: lineSeries->BarRendererOptions
- jqprBlockRenderer: lineSeries->BlockRendererOptions
- jqprBubbleRenderer: lineSeries->BubbleRendererOptions
- jqprDonutRenderer,lineSeries->DonutRendererOptions
- jqprFunnelRenderer: lineSeries->FunnelRendererOptions
, jqprLineRenderer,lineSeries->LineRendererOptions
- jqprMekkoRenderer, lineSeries->MekkoRendererOptions
- jqprMeterGaugeRenderer lineSeries->MeterGaugeRendererOptions
, jqprOHLCRenderer, lineSeries->OHLCRendererOptions
- jqprPieRenderer, lineSeries->PieRendererOptions
- jqprBezierCurveRenderer lineSeries->BezierCurveRendererOptions
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58

Next

Return to JQPlot

Who is online

Users browsing this forum: No registered users and 1 guest

Contact Us.