Chart.PlotBy = xlColumns or xlRows

Questions and answers on how to use XLSReadWriteII 5.
Post Reply
jcpozi
Posts: 11
Joined: Mon Feb 04, 2019 3:19 pm

Chart.PlotBy = xlColumns or xlRows

Post by jcpozi »

Chart.PlotBy = xlColumns or xlRows

Can be done
larsa
Site Admin
Posts: 926
Joined: Mon Jun 27, 2005 9:30 pm

Re: Chart.PlotBy = xlColumns or xlRows

Post by larsa »

Hello

I don't understand. What is it that you want to do?
Lars Arvidsson, Axolot Data
jcpozi
Posts: 11
Joined: Mon Feb 04, 2019 3:19 pm

Re: Chart.PlotBy = xlColumns or xlRows

Post by jcpozi »

larsa wrote:Hello

I don't understand. What is it that you want to do?
when doing the graphic I get it like that. attached image


https://drive.google.com/file/d/18sbCX9 ... sp=sharing

but I want it to come out like this.
thanks


https://drive.google.com/file/d/1EDqZmn ... sp=sharing
larsa
Site Admin
Posts: 926
Joined: Mon Jun 27, 2005 9:30 pm

Re: Chart.PlotBy = xlColumns or xlRows

Post by larsa »

Hello

You have added 4 series in the first example. Add 2 series and set the source area to the values you want to include.
Lars Arvidsson, Axolot Data
jcpozi
Posts: 11
Joined: Mon Feb 04, 2019 3:19 pm

Re: Chart.PlotBy = xlColumns or xlRows

Post by jcpozi »

Attached source code.
According to the code, it makes me the first link.
What to do to get out with the second link.
Thank you.

var
XLS: TXLSReadWriteII5;
RCells: TXLSRelCells;
ChartSpace: TCT_ChartSpace;

begin
XLS := TXLSReadWriteII5.Create(Nil);

XLS[0].AsFloat[2,0] := 15;
XLS[0].AsFloat[3,0] := 25;
XLS[0].AsFloat[4,0] := 30;
XLS[0].AsFloat[5,0] := 12;

XLS[0].AsFloat[2,1] := 90;
XLS[0].AsFloat[3,1] := 90;
XLS[0].AsFloat[4,1] := 90;
XLS[0].AsFloat[5,1] := 90;

RCells := XLS[0].CreateRelativeCells;
RCells.SetArea(2,0,5,1);

ChartSpace := XLS[0].Drawing.Charts.MakeLineChart(RCells,1,5);

XLS[0].Drawing.Charts[0].Col1 := 1;
XLS[0].Drawing.Charts[0].Col2 := 15;

XLS.Filename := 'E:\_JCCP\pruebas\wtest.xlsx';
XLS.Write;

XLS.Free;
jcpozi
Posts: 11
Joined: Mon Feb 04, 2019 3:19 pm

Re: Chart.PlotBy = xlColumns or xlRows

Post by jcpozi »

larsa wrote:Hello

You have added 4 series in the first example. Add 2 series and set the source area to the values you want to include.



Could you tell me how to do it with the example below, Thanks
larsa
Site Admin
Posts: 926
Joined: Mon Jun 27, 2005 9:30 pm

Re: Chart.PlotBy = xlColumns or xlRows

Post by larsa »

Hello

Example:

Code: Select all

  FXSS.XLS[0].AsFloat[0,2] := 15;
  FXSS.XLS[0].AsFloat[0,3] := 25;
  FXSS.XLS[0].AsFloat[0,4] := 30;
  FXSS.XLS[0].AsFloat[0,5] := 12;

  FXSS.XLS[0].AsFloat[1,2] := 90;
  FXSS.XLS[0].AsFloat[1,3] := 90;
  FXSS.XLS[0].AsFloat[1,4] := 90;
  FXSS.XLS[0].AsFloat[1,5] := 90;

  RCells := FXSS.XLS[0].CreateRelativeCells;
  RCells.SetArea(0,2,1,5);

  FXSS.XLS[0].Drawing.Charts.MakeLineChart(RCells,1,5);

  FXSS.XLS[0].Drawing.Charts[0].Col1 := 5;
  FXSS.XLS[0].Drawing.Charts[0].Col2 := 12;
Lars Arvidsson, Axolot Data
jcpozi
Posts: 11
Joined: Mon Feb 04, 2019 3:19 pm

Re: Chart.PlotBy = xlColumns or xlRows

Post by jcpozi »

Hello the example that you have sent me is a solution.

But what I need is to represent it as the image that I attach. Yours is 1 but I want it to be like 2.
Thank you.


Image


https://drive.google.com/file/d/19Q3n4z ... sp=sharing
larsa
Site Admin
Posts: 926
Joined: Mon Jun 27, 2005 9:30 pm

Re: Chart.PlotBy = xlColumns or xlRows

Post by larsa »

Hello
You can't do that with the MakeLineChart procedure but if you take a look at the source code of MakeLineChart you will see how to modify it. It's very few lines of code.
Lars Arvidsson, Axolot Data
jcpozi
Posts: 11
Joined: Mon Feb 04, 2019 3:19 pm

Re: Chart.PlotBy = xlColumns or xlRows

Post by jcpozi »

sample combined chart

BarChart and LineChart

Thanks.
larsa
Site Admin
Posts: 926
Joined: Mon Jun 27, 2005 9:30 pm

Re: Chart.PlotBy = xlColumns or xlRows

Post by larsa »

Hello

Sorry but I don't have a sample for this. You have to create one serie for each chart type (bar and line) in the chart.
Lars Arvidsson, Axolot Data
Post Reply