I have a horizontal bar series in a chart. A customer wants the axis line on the bottom of the chart to extend farther left, and one at the top that matches. See here:
I put arrows showing the lines.
Is something like this possible? (I have attached a demo--if it can be done, do you mind updating the demo).
Much appreciated.
Ed Dressel
Top/Bottom line in a chart
Top/Bottom line in a chart
- Attachments
-
- HorzSeriesExtentAxisLeft.zip
- (6.77 KiB) Downloaded 1077 times
Ed Dressel
President
RetireReady Solutions
President
RetireReady Solutions
Re: Top/Bottom line in a chart
Hello,
Here with a margin of 10 pixels each side:
Here with a margin of 10 pixels each side:
- Attachments
-
- HorzSeriesExtentAxisLeft.zip
- (2.11 KiB) Downloaded 1076 times
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Top/Bottom line in a chart
Thank you. That works perfect for the TChart, but when I create an image of the chart with a different width, the lines are not the correct width. See the attached demo--the red lines are painted in the AfterDraw event and are not the correct width.
- Attachments
-
- HorzSeriesExtentAxisLeft.zip
- (3.1 KiB) Downloaded 1108 times
Ed Dressel
President
RetireReady Solutions
President
RetireReady Solutions
Re: Top/Bottom line in a chart
Hello,
This is an option:
Add two new variables in the var declarations of the Form:
In FormCreate initialise the variables:
In the AssignChartToGraphic method add in a set for aWidth:
In the OnAfterDraw event add in the variable width size and reset the variable.
ie.
Unit attached.
Regards,
Marc
This is an option:
Add two new variables in the var declarations of the Form:
Code: Select all
var
Form1: TForm1;
aWidth, chartWidth : Integer; ///<-- these
Code: Select all
procedure TForm1.FormCreate(Sender: TObject);
var
I: Integer;
lValue: Double;
begin
aWidth:=Chart1.Width; //<-- here
chartWidth:=aWidth; //<-- and here
Series1.Clear;
Code: Select all
lCanvasClass := TCanvas3DClass(aChart.Canvas.ClassType);
if lCanvasClass <> TTeeCanvas3D then
aChart.Canvas := TTeeCanvas3D.Create;
aWidth:=aRect.Right; //<--- here
lHoldGradientVisible := aChart.Gradient.Visible;
ie.
Code: Select all
procedure TForm1.Chart1AfterDraw(Sender: TObject);
begin
with Chart1.Canvas do begin
Pen.Color := clRed;
Pen.Width := Chart1.BottomAxis.Axis.Width;
HorizLine3D(10,aWidth-10,Chart1.ChartRect.Top,0);
HorizLine3D(10,aWidth-10,Chart1.Axes.Bottom.PosAxis+1,0);
aWidth:=chartWidth; //reset
end;
end;
Regards,
Marc
Steema Support