How to get rid of horizontal line in table when moving to the next page in Migradoc - pdf-generation

I am still learning Migradoc and C# for that matter so sorry if my code is a little bit verbose but it seems if my table doesn't fit towards the bottom, it goes to the next page which is okay. But I also notice that it creates an extra horizontal line between the tables information and the headers (date, staff, notes, bill etc). I have tried everything from making the borders visibility to false and the whole rows visibility to false but it does not work. Here is what it looks like:
Here is the code I have:
Table timeDetailTable2 = section.AddTable();
timeDetailTable2.Rows.LeftIndent = "-1cm";
timeDetailTable2.Borders.Width = 0.75;
Column column6 = timeDetailTable2.AddColumn(Unit.FromCentimeter(2));
column6.Format.Alignment = ParagraphAlignment.Center;
column6 = timeDetailTable2.AddColumn(Unit.FromCentimeter(3));
column6.Format.Alignment = ParagraphAlignment.Left;
column6 = timeDetailTable2.AddColumn(Unit.FromCentimeter(4.75));
column6.Format.Alignment = ParagraphAlignment.Left;
column6 = timeDetailTable2.AddColumn(Unit.FromCentimeter(1));
column6.Format.Alignment = ParagraphAlignment.Center;
column6 = timeDetailTable2.AddColumn(Unit.FromCentimeter(1.5));
column6.Format.Alignment = ParagraphAlignment.Center;
column6 = timeDetailTable2.AddColumn(Unit.FromCentimeter(3.75));
column6.Format.Alignment = ParagraphAlignment.Left;
column6 = timeDetailTable2.AddColumn(Unit.FromCentimeter(2));
column6.Format.Alignment = ParagraphAlignment.Right;
Row row6 = timeDetailTable2.AddRow();
Cell cell6 = row6.Cells[0];
cell6.Format.Font.Size = 9;
cell6.Format.Alignment = ParagraphAlignment.Left;
cell6.Shading.Color = Colors.LightGray;
cell6.MergeRight = 6;
cell6.AddParagraph("Charge To: ADV Integrity / Error Message on Outlook Location: NO NOT USE");
cell6.Format.Font.Bold = true;
row6 = timeDetailTable2.AddRow();
cell6 = row6.Cells[0];
cell6.AddParagraph("Date");
cell6 = row6.Cells[1];
cell6.AddParagraph("Staff");
cell6 = row6.Cells[2];
cell6.AddParagraph("Notes");
cell6 = row6.Cells[3];
cell6.AddParagraph("Bill");
cell6 = row6.Cells[4];
cell6.AddParagraph("Hours");
cell6 = row6.Cells[5];
cell6.AddParagraph("Rate");
cell6 = row6.Cells[6];
cell6.AddParagraph("Ext Amt");
for (int i = 0; i <= 6; i++)
{
cell6 = row6.Cells[i];
cell6.Borders.Left.Visible = false;
cell6.Borders.Right.Visible = false;
cell6.Borders.Top.Visible = false;
cell6.Format.Font.Bold = true;
cell6.Format.Font.Size = 9;
}
row6 = timeDetailTable2.AddRow();
cell6 = row6.Cells[0];
cell6.AddParagraph();
cell6.MergeRight = 6;
cell6.Borders.Bottom.Visible = false;
cell6.Row.Borders.Visible = false;
row6 = timeDetailTable2.AddRow();
cell6 = row6.Cells[0];
cell6.Format.Font.Size = 9;
cell6.AddParagraph("04/09/2020");
cell6.Borders.Right.Visible = false;
cell6 = row6.Cells[1];
cell6.Format.Font.Size = 9;
cell6.AddParagraph("Beed, Jacob");
cell6.Borders.Right.Visible = false;
cell6 = row6.Cells[2];
cell6.Format.Font.Size = 9;
cell6.Format.Font.Bold = true;
paragraph = cell6.AddParagraph("Service Ticket:");
paragraph.AddFormattedText(" 41466", TextFormat.NotBold);
cell6.AddParagraph();
paragraph2 = cell6.AddParagraph("Summary:");
paragraph2.AddFormattedText(" New e-mail needed please, ASAP", TextFormat.NotBold);
cell6.AddParagraph();
paragraph3 = cell6.AddParagraph("");
paragraph3.AddFormattedText("Created new email address for webinars and assigned exchange online" +
"license. Mailbox will be available shortly.", TextFormat.NotBold);
cell6.Borders.Right.Visible = false;
cell6 = row6.Cells[3];
cell6.Format.Font.Size = 9;
cell6.AddParagraph("Y");
cell6.Borders.Right.Visible = false;
cell6 = row6.Cells[4];
cell6.Format.Font.Size = 9;
cell6.AddParagraph("0.50");
cell6.Borders.Right.Visible = false;
cell6 = row6.Cells[5];
cell6.Format.Font.Size = 9;
cell6.AddParagraph("125.00");
cell6.Borders.Right.Visible = false;
cell6 = row6.Cells[6];
cell6.Format.Font.Size = 9;
cell6.AddParagraph("$62.50");
//adding horizontal line
row5 = timeDetailTable2.AddRow();
row5.Borders.Visible = false;
row6 = timeDetailTable2.AddRow();
for(int i = 0; i <= 5; i++)
{
cell6 = row6.Cells[i];
cell6.Borders.Right.Visible = false;
}
cell6 = row6.Cells[5];
cell6.Format.Font.Size = 9;
cell6.MergeRight = 1;
cell6.Format.Alignment = ParagraphAlignment.Right;
cell6.Format.Font.Bold = true;
cell6.AddParagraph("Subtotal: $187.50");
for (int i = 0; i <= 6; i++)
{
cell6 = row6.Cells[i];
cell6.Borders.Bottom.Visible = false;
cell6.Borders.Left.Visible = false;
cell6.Borders.Right.Visible = false;
}
I have the same code basically for the table above except I have it named timeDetailTable instead of timeDetailTable2 of type Table. How can I prevent that extra horizontal line between the header and table whenever I go to a new page?

I guess the line you see is the top border of the first row on the following page. Maybe this makes no sense at first glance.
Horizontal borders are the combination of the bottom border of the line above and the top border of the line below. And I assume this combination is made without respect to pagebreaks.
I'm afraid you cannot really do anything about this line appearing in that situation. But there are workarounds.
But IMHO it is odd to have the header and the spacer line at the end of the first page and the first data on the second page. This can easily be avoided by setting KeepWith for the first row of the block of rows you want to keep together.
Another option is marking the first rows (including the spacer row) as heading rows. Heading rows will be repeated whenever the table breaks to the next page. This should also prevent heading rows from appearing at the bottom of the page without any data row.

Related

Adding row in table that has pagination but it is not adding in end

I have a table with pagination that has 29 rows in it. I want to add a new row after the last row in the table. I am using following code to add new row in the table.
var table = document.getElementById("MyExistingRandomTaskList");
var row = table.insertRow(-1);
var cell1 = row.insertCell(0); // Serial No
var cell2 = row.insertCell(1); // Task No
var cell3 = row.insertCell(2); // Task Description
var cell4 = row.insertCell(3); // Assign Date
var cell5 = row.insertCell(4); // Task Timeline
var cell6 = row.insertCell(5); // Assign To
var cell7 = row.insertCell(6); // Complete %
var cell8 = row.insertCell(7); // Status
var cell9 = row.insertCell(8); // Edit Icon
cell1.innerHTML = document.getElementById("MyExistingRandomTaskList").rows.length;
cell2.innerHTML = "R-1";
cell3.innerHTML = document.getElementById("rbDescription").value;
cell4.innerHTML = "01-01-2021";
cell5.innerHTML = rStartDate + "-" + rEndDate;
cell6.innerHTML = "Assign To Many";
cell7.innerHTML = "0%";
cell8.innerHTML = "Working On";
cell9.innerHTML = "Edit";
cell1.align = cell2.align = cell3.align = cell4.align = cell5.align = "left";
cell6.align = cell7.align = cell8.align = cell9.align = "left";
var myTable = $('#MyExistingRandomTaskList').DataTable();
myTable.draw();

Amcharts V4 mark values on series with known value

I have a amChart4 XYChart loaded from a CSV external file.
How to mark the max values on a serie, max values are known when writing the file. So just need to mark the data points with a bullet.
var maxNm = 404.24;
var maxHP = 327.7;
Se code with working chart loaded from CSV.
https://codepen.io/lasse-kofoed/pen/WNbNXxe
// Themes begin
am4core.useTheme(am4themes_material);
am4core.useTheme(am4themes_animated);
// Themes end
// Create chart instance
var chart = am4core.create("chartdiv", am4charts.XYChart);
chart.responsive.enabled = true;
// Set up data source
chart.dataSource.url = "https://master.tus.io/files/a6bfda6a8051313c0c0b1d7129a75786+DB7aQwWVBca.GAK4H6FLamUT58549Asv6vLoR9kEJySMEVOsFlCSi9eqzgMYLhqXdMJDZoTE0C90HuVUUKD7KoKdFjlM0f1IRkkQ0L5X6iykr8kSsyNWTtPkcmzIFwDp";
chart.dataSource.parser = new am4core.CSVParser();
chart.dataSource.parser.options.useColumnNames = true;
// Increase contrast by taking evey second color
chart.colors.step = 2;
chart.dataSource.events.on("error", function (ev) {
console.log("Oopsy! Something went wrong");
});
// Create value axis
var valueAxis = chart.yAxes.push(new am4charts.ValueAxis());
valueAxis.tooltip.disabled = true;
valueAxis.title.text = "Power & Torque";
var categoryAxis = chart.xAxes.push(new am4charts.CategoryAxis());
categoryAxis.dataFields.category = "Rpm";
// Create serie Nm
var nm = chart.series.push(new am4charts.LineSeries());
var maxNm = 404.24;
nm.dataFields.valueY = "Nm";
nm.dataFields.categoryX = "Rpm";
nm.yAxis = valueAxis;
nm.name = "Nm";
nm.strokeWidth = 1;
//nm.tensionX = 0.7;
nm.tooltipText = "{valueY.value} Nm";
var hp = chart.series.push(new am4charts.LineSeries());
var maxHP = 327.7;
hp.dataFields.valueY = "Hp";
hp.dataFields.categoryX = "Rpm";
hp.yAxis = valueAxis;
hp.name = "Hp";
hp.strokeWidth = 1;
//hp.tensionX = 0.7;
hp.tooltipText = "{valueY.value} Hp";
// Add legend
chart.legend = new am4charts.Legend();
// Add cursor
chart.cursor = new am4charts.XYCursor();
Updated a CodePen with the result.
https://codepen.io/lasse-kofoed/pen/eYmprPR
Found that using the event beforedatavalidated you can alter the data and set a field to false.
And then set propertyFields.disabled = true on a bullet object ( hides all bullets )
and .propertyFields.disabled to the field name that was added to the data list item ( show on bullets on values that have the field set to false )
chart.series.values[0].dataItem.values.valueY
Also found that the max and min values can be found here, but is not using that information in the example
// Add max Torque bullet
var maxTorque = nm.bullets.push(new am4charts.CircleBullet());
maxTorque.disabled = true;
maxTorque.propertyFields.disabled = "maxTorque";
maxTorque.radius = 8;
maxTorque.strokeWidth = 2;
maxTorque.stroke = am4core.color("#fff");
var maxTorqueLabel = nm.bullets.push(new am4charts.LabelBullet());
maxTorqueLabel.label.text = "Max torque\n[bold]{valueY} {name}#{categoryX}[/]";
maxTorqueLabel.disabled = true;
maxTorqueLabel.propertyFields.disabled = "maxTorque";
maxTorqueLabel.label.dy = -30;
// Add max Power bullet
var maxPower = hp.bullets.push(new am4charts.CircleBullet());
maxPower.disabled = true;
maxPower.propertyFields.disabled = "maxPower";
var maxPowerLabel = hp.bullets.push(new am4charts.LabelBullet());
maxPowerLabel.label.text = "Max power\n[bold]{valueY} {name}#{categoryX}[/]";
maxPowerLabel.disabled = true;
maxPowerLabel.propertyFields.disabled = "maxPower";
maxPowerLabel.label.dy = -30;
chart.events.on("beforedatavalidated", function(ev) {
var maxT = chart.data.find(x => x.Rpm === "5221");
var maxP = chart.data.find(x=> x.Rpm === "5888");
if(typeof maxT !== "undefined")
{
maxT.maxTorque = false;
}
if(typeof maxP !== "undefined")
{
maxP.maxPower = false;
}
});

Amchart with two lines

i have an amchart with two lines:
<script type="text/javascript">
var chart;
var graph;
var chartData2 = [
{"year":"2014-10-04 23:30:03", "v1":9.1, "v2":0},
{"year":"2014-10-04 23:45:02", "v1":8.8, "v2":86.2},
...
{"year":"2014-10-05 23:30:02", "v1":8.7, "v2":98.7},
{"year":"2014-10-05 23:45:02", "v1":8.5, "v2":98.7},
{"year":"2014-10-06 00:00:01", "v1":8.4, "v2":98.5},
{"year":"2014-10-06 00:15:02", "v1":8.5, "v2":98.3},
{"year":"2014-10-06 00:30:01", "v1":8.4, "v2":97.9}
];
AmCharts.ready(function () {
// SERIAL CHART
chart = new AmCharts.AmSerialChart();
chart.pathToImages = "../amcharts/images/";
chart.dataProvider = chartData2;
chart.marginLeft = 10;
chart.categoryField = "year";
chart.dataDateFormat = "JJ:NN:SS";
//chart.addListener("dataUpdated", zoomChart);
// AXES
// category
var categoryAxis = chart.categoryAxis;
categoryAxis.parseDates = true;
categoryAxis.minPeriod = "100";
categoryAxis.dashLength = 3;
categoryAxis.minorGridEnabled = true;
categoryAxis.minorGridAlpha = 0.1;
// value
var valueAxis = new AmCharts.ValueAxis();
valueAxis.id = "ax1";
valueAxis.axisAlpha = 0;
valueAxis.inside = true;
valueAxis.dashLength = 3;
valueAxis.position = "right";
chart.addValueAxis(valueAxis);
var valueAxis2 = new AmCharts.ValueAxis();
valueAxis2.id = "ax2";
valueAxis2.axisAlpha = 0;
valueAxis2.inside = true;
valueAxis2.dashLength = 3;
valueAxis2.baseValue = -20;
valueAxis2.position = "left";
chart.addValueAxis(valueAxis2);
// GRAPH
graph = new AmCharts.AmGraph();
graph.valueaxis = "ax1";
graph.type = "smoothedLine";
graph.lineColor = "#d1655d";
graph.negativeLineColor = "#637bb6";
graph.bullet = "square";
graph.bulletSize = 8;
graph.bulletBorderColor = "#FFFFFF";
graph.bulletBorderAlpha = 1;
graph.bulletBorderThickness = 2;
graph.lineThickness = 2;
graph.valueField = "v1";
graph.title = "title v1";
graph.balloonText = "[[category]]<br><b><span style='font-size:14px;'>[[value]]</span></b>";
chart.addGraph(graph);
graph2 = new AmCharts.AmGraph();
graph2.valueAxis = "ax2";
graph2.type = "smoothedLine";
graph2.lineColor = "#d1655d";
graph2.negativeLineColor = "#637bb6";
graph2.bullet = "round";
graph2.bulletSize = 8;
graph2.bulletBorderColor = "#FFFFFF";
graph2.bulletBorderAlpha = 1;
graph2.bulletBorderThickness = 2;
graph2.lineThickness = 2;
graph2.valueField = "v2";
graph2.title = "title v2";
graph2.balloonText = "[[category]]<br><b><span style='font-size:14px;'>[[value]]</span></b>";
chart.addGraph(graph2);
// CURSOR
var chartCursor = new AmCharts.ChartCursor();
chartCursor.cursorAlpha = 0;
chartCursor.cursorPosition = "mouse";
chartCursor.categoryBalloonDateFormat = "JJ:NN:SS";
chart.addChartCursor(chartCursor);
// SCROLLBAR
var chartScrollbar = new AmCharts.ChartScrollbar();
chart.addChartScrollbar(chartScrollbar);
chart.creditsPosition = "bottom-right";
// WRITE
chart.write("chartdiv2");
});
I can see the x-and y-axis, but no lines with values. Can anyone please help me?
Two problems:
dataDateFormat is incorrect, should be: chart.dataDateFormat = "YYYY-MM-DD JJ:NN:SS";
minPeriod is incorrect, should be: categoryAxis.minPeriod = "ss";

How to properly fix contacts in SpriteKit?

I use this code and it has to work, but it doesn't:
static const uint32_t platformCategory = 0x1 << 1;
static const uint32_t playerCategory = 0x1 << 2;
Code of player:
self.player = [SKSpriteNode spriteNodeWithImageNamed:#"player"];
self.player.physicsBody = [SKPhysicsBody bodyWithRectangleOfSize:self.player.size];
self.player.physicsBody.dynamic = false;
self.player.physicsBody.friction = 0;
self.player.physicsBody.usesPreciseCollisionDetection = true;
self.player.physicsBody.categoryBitMask = playerCategory;
self.player.physicsBody.collisionBitMask = platformCategory;
self.player.physicsBody.contactTestBitMask = platformCategory;
[self addChild:self.player];
And code of "platforms":
- (void)addPlatformRight {
int plType = arc4random()%3;
SKSpriteNode * platform = [SKSpriteNode spriteNodeWithImageNamed:[NSString stringWithFormat:#"platform%d", plType]];
platform.position = CGPointMake(self.frame.size.width+100, self.frame.size.height-200);
platform.size = CGSizeMake(platform.size.width*1.2, platform.size.height*2);
platform.physicsBody = [SKPhysicsBody bodyWithRectangleOfSize:platform.size];
platform.physicsBody.dynamic = false;
platform.physicsBody.friction = 0;
platform.physicsBody.usesPreciseCollisionDetection = true;
platform.physicsBody.categoryBitMask = platformCategory;
platform.physicsBody.contactTestBitMask = playerCategory;
platform.physicsBody.collisionBitMask = playerCategory;
[self addChild:platform];
[platform runAction:[SKAction sequence:#[[SKAction rotateByAngle:M_PI/4.0*8 duration:3], [SKAction removeFromParent]]]];
}
And
- (void)didBeginContact:(SKPhysicsContact *)contact {
NSLog(#"contact");
}
Unfortunately, this doesn't work. Are there any errors?
two overlapping non-dynamic bodies do not generate contact events, at least one of them has to be dynamic

How to show polynomial tread line in Am-Line chart

How can i show a polynomial tread line in Am-line chart. I'm getting a straight trend line here, i need a polynomial trend line. My javascript code is shown below. Please someone help me to solve this issue.
function GenChartData() {
var data1 = [0.234761158, 0.23816127, 0.263960124, 0.282558558, 0.300607979, 0.318197719, 0.316059534, 0.319133276, 0.322505238, 0.323926338, 0.323720379, 0.3203703, 0.318837626, 0.318380371, 0.321465339, 0.316398839, 0.310238176, 0.301206892, 0.278454166, 0.268778255, 0.250299958, 0.23754735, 0.216277621, 0.182483871, 0.152057602, 0.129372542, 0.079524595, 0.044074801, 0.007279248, -0.021369877, -0.022801251, -0.043247196, -0.060677351, -0.055932729, -0.055847788, -0.032625365, -0.027289726, -0.022615401, -0.010850169, 0.015833104, 0.043923065, 0.055500831, 0.048043121, 0.054154849, 0.064038257, 0.049914887, 0.046542406, 0.03154397, 0.033614909, 0.030570225, 0.035606699, 0.001179461, -0.028934007, -0.019034206, 2.30344E-05];
var dates = ["12/31/2001", "1/31/2002", "2/28/2002", "3/31/2002", "4/30/2002", "5/31/2002", "6/30/2002", "7/31/2002", "8/31/2002", "9/30/2002", "10/31/2002", "11/30/2002", "12/31/2002", "1/31/2003", "2/28/2003", "3/31/2003", "4/30/2003", "5/31/2003", "6/30/2003", "7/31/2003", "8/31/2003", "9/30/2003", "10/31/2003", "11/30/2003", "12/31/2003", "1/31/2004", "2/29/2004", "3/31/2004", "4/30/2004", "5/31/2004", "6/30/2004", "7/31/2004", "8/31/2004", "9/30/2004", "10/31/2004", "11/30/2004", "12/31/2004", "1/31/2005", "2/28/2005", "3/31/2005", "4/30/2005", "5/31/2005", "6/30/2005", "7/31/2005", "8/31/2005", "9/30/2005", "10/31/2005", "11/30/2005", "12/31/2005", "1/31/2006", "2/28/2006", "3/31/2006", "4/30/2006", "5/31/2006", "6/30/2006"];
for (var i = 0; i < dates.length; i++) {
chartData.push({
date: new Date(dates[i]),
data1: data1[i]});
}
}
AmCharts.ready(function () {
// SERIAL CHART
GenChartData();
chart = new AmCharts.AmSerialChart();
chart.pathToImages = "JS/AmFiles/amcharts/images/";
chart.marginTop = 0;
chart.marginRight = 10;
chart.autoMarginOffset = 5;
//chart.backgroundColor = "#CCCCC";
chart.zoomOutButton = {
backgroundColor: '#000000',
backgroundAlpha: 0.15
};
chart.dataProvider = chartData;
chart.categoryField = "date";
// listen for "dataUpdated" event (fired when chart is rendered) and call zoomChart method when it happens
chart.addListener("dataUpdated", zoomChart);
// AXES
// category
var categoryAxis = chart.categoryAxis;
categoryAxis.parseDates = true; // as our data is date-based, we set parseDates to true
categoryAxis.minPeriod = "MM"; // our data is daily, so we set minPeriod to DD
categoryAxis.dashLength = 1;
categoryAxis.gridAlpha = 0.15;
categoryAxis.axisColor = "#DADADA";
categoryAxis.labelFrequency = 1;
categoryAxis.equalSpacing = true;
// value
var valueAxis = new AmCharts.ValueAxis();
valueAxis.axisAlpha = 0.2;
valueAxis.dashLength = 1;
chart.addValueAxis(valueAxis);
graph = new AmCharts.AmGraph();
graph.type = "smoothedLine";
graph.lineColor = "#180ad1";
graph.negativeLineColor = "#180ad1";
graph.bullet = "round";
graph.bulletSize = 5;
graph.lineThickness = 2;
graph.valueField = "data1";
chart.addGraph(graph);
// CURSOR
chartCursor = new AmCharts.ChartCursor();
chartCursor.cursorPosition = "mouse";
chart.addChartCursor(chartCursor);
// TREND LINES
// first trend line
var trendLine = new AmCharts.TrendLine();
trendLine.initialDate = new Date(chartData[0].date); // 12 is hour - to start trend line in the middle of the day
trendLine.finalDate = new Date(chartData[chartData.length-1].date);
trendLine.initialValue = 0.234761158;
trendLine.finalValue = 2.30344E-05;
trendLine.lineColor = "#CC0000";
chart.addTrendLine(trendLine);
// WRITE
chart.write("chartdiv");
});
Thanks for your help
You would need to basically have another graphline on there rather than a trendline.
You can look at this example - http://www.amcharts.com/javascript-charts/line-with-different-bullet-sizes/
to see how to equip multiple data graphs.

Resources