Recharts When Using ComposedChart Bar is over YAxis - recharts

https://jsfiddle.net/9d5gc80z/
<ComposedChart width={600} height={400} data={data}
margin={{top: 20, right: 20, bottom: 20, left: 20}}>
<CartesianGrid stroke='#f5f5f5'/>
<XAxis dataKey="name"/>
<YAxis />
<Tooltip />
<Legend />
<Area type='monotone' dataKey='amt' fill='#8884d8' stroke='#8884d8'/>
<Bar dataKey='pv' barSize={20} fill='#413ea0' />
<Line type='monotone' dataKey='uv' stroke='#ff7300' />
</ComposedChart>
in this example first bar is over YAxis.
how to save gap between bar and YAxis?
Correct example with BarChart
https://jsfiddle.net/3z98Lqyh/
<BarChart width={600} height={300} data={data}
margin={{top: 20, right: 30, left: 20, bottom: 5}}>
<CartesianGrid strokeDasharray="3 3"/>
<XAxis dataKey="name"/>
<YAxis/>
<Tooltip/>
<Legend />
<Bar dataKey="pv" stackId="a" fill="#8884d8" />
<Bar dataKey="uv" stackId="a" fill="#82ca9d" />
</BarChart>

Use the XAxis padding prop like this:
<XAxis dataKey="name" padding={{ left: 20, right: 20 }} />
More info here:
https://recharts.org/en-US/api/XAxis

Related

How to use FlyControls in react-three-fiber?

I just changing OrbitControls to FlyControls.
However, it seems FlyControls is not working with PerspectiveCamera.
Am I missing some props for FlyControls?
function Product() {
return (
<Suspense fallback={null}>
<Canvas >
<PerspectiveCamera makeDefault fov={90} position={[0, 0, 10]} />
<FlyControls
autoForward={false}
dragToLook={false}
movementSpeed={10}
rollSpeed={0.005}
makeDefault
/>
<color args={[0, 0, 0]} attach="background" />
<Model />
<ambientLight intensity={0.1} />
</Canvas>
</Suspense>
)
}
<OrbitControls
maxPolarAngle={1.5}
target={[0, 0, 0]}
enableZoom={true}
enablePan={true}
enableRotate={true}
makeDefault />

How to automatically scroll down to the last row of table in sapUI5?

I need to implement load more in my table with dynamic values. This is my screen.
Initially, I have displayed the values from api call. On that time my table should be scroll down automatically to the last row of the table. Then I clicked the load more button again the api calls and added the new values in the model and added into the table too. But its not scrolling down to the table. Here is the controller code I have tried for scroll down.
var oTableModel = new sap.ui.model.json.JSONModel();
oTableModel .setSizeLimit(TABLE_ARRAY.length);
oTableModel .setData({
oset: TABLE_ARRAY
});
that.getView().byId("oSmartTable").setModel(oTableModel);
//that.getView().byId("otable").getBinding("items").refresh();
var oTable = that.getView().byId("logtable");
var oLength = TABLE_ARRAY.length - 1;
//New Item that is added
var oItem = oTable.getItems()[oLength];
var oScroll = that.getView().byId("oscroll");
//Add Delay since the new item needs to be added to the HTML Doc
jQuery.sap.delayedCall(100, that, function () {
//Scroll to the newly added item
oScroll.scrollToElement(oItem);
});
And this is view.xml code for smart table
<ScrollContainer id="oscroll" height="100%" width="99%" horizontal="false" vertical="true">
<VBox class="chartBackground" alignItems="Stretch" width="100%" id="logTableVB">
<items>
<smartTable:SmartTable id="oSmartTable" entitySet="oset" smartFilterId="smartFilterBar" tableType="ResponsiveTable"
app:p13nDialogSettings="{sort:{items:[{ columnKey: 'Type', operation: 'Ascending' }]}}" useExportToExcel="false"
beforeExport="onBeforeExport" useVariantManagement="true" useTablePersonalisation="true" showTablePersonalisation="true"
header="Total Logs " showRowCount="true" showFullScreenButton="true" enableAutoBinding="true">
<Table id="logtable" sticky="ColumnHeaders" class="headercolor" growingScrollToLoad="true" growing="true" growingThreshold="50">
<!--firstVisibleRowChanged="scroll"-->
<columns getResizable="true">
<Column minScreenWidth="Tablet" demandPopin="true" width="10%">
<customData>
<core:CustomData key="p13nData"
value='\{"sortProperty": "c1_data", "filterProperty": "c1_data","columnKey": "Column 1", "leadingProperty" : "c1_data"}'/>
</customData>
<Text class="headercolor" text="Column 1"/>
</Column>
<Column minScreenWidth="Tablet" demandPopin="true" width="15%">
<customData>
<core:CustomData key="p13nData"
value='\{"sortProperty": "c2_data", "filterProperty": "c2_data","columnKey": "Column 2", "leadingProperty" : "c2_data"}'/>
</customData>
<Text class="headercolor" text="Column 2"/>
</Column>
<Column minScreenWidth="Tablet" demandPopin="true" width="15%">
<customData>
<core:CustomData key="p13nData"
value='\{"sortProperty": "c3_data", "filterProperty": "c3_data","columnKey": "Column 3", "leadingProperty" : "c3_data"}'/>
</customData>
<Text class="headercolor" text="Column 3"/>
</Column>
<Column minScreenWidth="Tablet" demandPopin="true" width="15%">
<customData>
<core:CustomData key="p13nData"
value='\{"sortProperty": "c4_data", "filterProperty": "c4_data","columnKey": "Column 4", "leadingProperty" : "c4_data"}'/>
</customData>
<Text class="headercolor" text="Column 4"/>
</Column>
<Column minScreenWidth="Tablet" demandPopin="true" width="15%">
<customData>
<core:CustomData key="p13nData"
value='\{"sortProperty": "c5_data", "filterProperty": "c5_data","columnKey": "Column 5", "leadingProperty" : "c5_data"}'/>
</customData>
<Text class="headercolor" text="Column 5"/>
</Column>
<Column minScreenWidth="Tablet" demandPopin="true">
<customData>
<core:CustomData key="p13nData"
value='\{"sortProperty": "c6_data", "filterProperty": "c6_data","columnKey": "Column 6", "leadingProperty" : "c6_data"}'/>
</customData>
<Text class="headercolor" text="Column6"/>
</Column>
</columns>
<items>
<ColumnListItem type="Active" press="onLogTableClick_">
<cells>
<Text class="tabletext" text="{c1_data}"/>
<Text class="tabletext" text="{c2_data}"/>
<Text class="tabletext" text="{c3_data}"/>
<Text class="tabletext" text="{c4_data}"/>
<Text class="tabletext" text="{c5_data}"/>
<Text class="tabletext" text="{c6_data}"/>
</cells>
</ColumnListItem>
</items>
</Table>
<HBox>
<items>
<HBox class="contactMarigin" width="100%" justifyContent="Start" alignItems="Center">
<items></items>
</HBox>
<HBox class="contactMarigin" width="100%" justifyContent="Center" alignItems="Center">
<items></items>
</HBox>
<HBox class="contactMarigin" width="100%" justifyContent="End" alignItems="Center">
<items>
<Button id="oload_more" text="Load More" class="pdfMarigin" />
</items>
</HBox>
</items>
</HBox>
</smartTable:SmartTable>
</items>
</VBox>
</ScrollContainer>
I have put my smart table inside scroll container. when I click load more button the should be scroll down automatically to the last row. How can I achieve this? Thanks in advance.
setTimeout(function () {
oScroll.scrollToElement(oTable.getItems()[oLength], 800);
}, 0);

Add href link in custom grid in webform ASP.NET and Get ID of Select Row using JQuery

I am trying to add inside custom grid within template but I cannot see these links in output along with other grid data ....
<cc0:Grid ID="StaffItemList" runat="server" FolderStyle="~/Styles/Grid" AutoGenerateColumns="false"
Width="100%" PageSizeOptions="5,10,20,50,100,-1" AllowFiltering="true" FilterType="ProgrammaticOnly"
AllowAddingRecords="false">
<Columns>
<cc0:CheckBoxSelectColumn ShowHeaderCheckBox="true" Width="50" ControlStyle-CssClass="UserInRoleGrid"></cc0:CheckBoxSelectColumn>
<cc0:Column DataField="id" HeaderText="ID" Visible="true" />
<cc0:Column DataField="loginid" HeaderText="loginid" Width="150" />
<cc0:Column DataField="forenames" HeaderText="forenames" />
<cc0:Column DataField="surnames" HeaderText="surnames" />
<cc0:Column DataField="gender" HeaderText="gender" />
<cc0:Column DataField="email" HeaderText="email" />
<cc0:Column DataField="deleted" HeaderText="deleted" />
</Columns>
<Templates>
<cc0:GridTemplate runat="server" ID="AddUserToRoleLink">
<Template>
addRole
</Template>
</cc0:GridTemplate>
</Templates>
</cc0:Grid>
I have found asnswer; code as following....
<cc0:Grid ID="StaffItemList" runat="server" FolderStyle="~/Styles/Grid" AutoGenerateColumns="false"
Width="100%" PageSizeOptions="5,10,20,50,100,-1" AllowFiltering="true" FilterType="ProgrammaticOnly"
AllowAddingRecords="false">
<Columns>
<cc0:Column DataField="id" HeaderText="ID" Visible="true"/>
<cc0:Column DataField="loginid" HeaderText="loginid" Width="150" />
<cc0:Column DataField="forenames" HeaderText="forenames" />
<cc0:Column DataField="surnames" HeaderText="surnames" />
<cc0:Column DataField="gender" HeaderText="gender" />
<cc0:Column DataField="email" HeaderText="email" />
<cc0:Column DataField="deleted" HeaderText="deleted" />
<cc0:Column DataField="Functions" HeaderText="deleted" >
<TemplateSettings TemplateId="AddUserToRoleControl"/>
</cc0:Column>
</Columns>
<Templates>
<cc0:GridTemplate runat="server" ID="AddUserToRoleControl">
<Template>
Add Role
</Template>
</cc0:GridTemplate>
</Templates>
</cc0:Grid>
jQuery
<script type="text/javascript">
$(document).ready(function () {
$(".AddStaffToRoleLink").on("click", function () {
var selectedStaffID = $(this).attr("id");
alert("this is " + selectedStaffID);
});
});
</script>

cursor hand symbol change in radhtmlchart columnseries chart

Please suggest on how to show the hand symbol on mouse hover of the telerik radhtmlchart.AS of now im getting only pointer symbol on mouse hover.
<telerik:radhtmlchart runat="server" id="RadHtmlChartfirst" onclientseriesclicked="OnClientSeriesClickedfirst"
legend-appearance-position="Top" legend-appearance-visible="true" plotarea-xaxis-minorgridlines-visible="false"
plotarea-yaxis-minorgridlines-visible="false" plotarea-xaxis-majorgridlines-visible="false"
plotarea-yaxis-majorgridlines-visible="false" height="444" width="900">
<PlotArea>
<Series>
<telerik:ColumnSeries DataFieldY="myValues1" Name="Name1">
</telerik:ColumnSeries>
<telerik:ColumnSeries DataFieldY="myValues2" Name="Name2">
</telerik:ColumnSeries>
<telerik:ColumnSeries DataFieldY="myValues3" Name="Name3">
</telerik:ColumnSeries>
</Series>
<XAxis DataLabelsField="myLabels">
</XAxis>
</PlotArea>
<Legend>
<Appearance Visible="true" Position="Bottom" />
</Legend>
<Appearance>
<FillStyle BackgroundColor="" />
</Appearance>
<ChartTitle Text="Reviewer Utilization Report">
</ChartTitle>
</telerik:radhtmlchart>
There is no built-in facility for that because this chart renders SVG and the cursor styles generally apply to HTML elements. I tried the following flimsy mouse event handling and it seems to kind of work though:
<telerik:RadHtmlChart runat="server" ID="chart" onmouseout="onmouseoutHandler();">
<ClientEvents OnSeriesHover="OnSeriesHover" />
<PlotArea>
<Series>
<telerik:ColumnSeries Name="first">
<SeriesItems>
<telerik:CategorySeriesItem Y="1" />
<telerik:CategorySeriesItem Y="2" />
<telerik:CategorySeriesItem Y="3" />
</SeriesItems>
</telerik:ColumnSeries>
<telerik:ColumnSeries Name="second">
<SeriesItems>
<telerik:CategorySeriesItem Y="1" />
<telerik:CategorySeriesItem Y="2" />
<telerik:CategorySeriesItem Y="3" />
</SeriesItems>
</telerik:ColumnSeries>
</Series>
</PlotArea>
</telerik:RadHtmlChart>
<script>
function OnSeriesHover(e) {
document.onmouseover = null;
if (e.series.name == "first") { //consider adding some conditions or removing them at all
e.preventDefault();
setTimeout(function () {
document.body.style.cursor = "pointer"
}, 50);
}
return false;
}
//attached to onmouseout of the chart wrapper to restore the cursor
//as soon as the mouse moves on the chart
function onmouseoutHandler(e) {
document.body.onmouseover = restoreCursor;
}
//the handler that restores the cursor for the page
function restoreCursor() {
document.body.style.cursor = "";
}
//resets the cursor
document.body.onmouseover = restoreCursor;
</script>
and I had to add this CSS to ensure my body element is large enough:
html, body, form
{
height: 100%;
margin: 0;
padding: 0;
}

jsplumb - hide connectors when scrolled out of view

We're hoping to use jsplumb to draw links between items in two parallel, scrollable lists - say, in divs with overflow=auto. If two items are linked, then the list is scrolled so that one of them is scrolled out of view, the part of the jsplumb link that's outside the div is still drawn. Below is an example page (needs a jquery js file and jsplumb js file in the same directory, as per the script includes shown):
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Untitled Page</title>
<script src="jquery-1.4.1.min.js" type="text/javascript"></script>
<script src="jquery.jsPlumb-1.3.8-all-min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
$('#leftdiv').scroll(function () {
jsPlumb.repaintEverything();
});
$('#rightdiv').scroll(function () {
jsPlumb.repaintEverything();
});
jsPlumb.importDefaults({
// default drag options
DragOptions: { cursor: 'pointer', zIndex: 2000 },
EndpointStyles: [{ fillStyle: '#225588' }, { fillStyle: '#558822'}],
Endpoints: [["Dot", { radius: 2}], ["Dot", { radius: 2}]]
});
var allSourceEndpoints = [], allTargetEndpoints = [];
var connectorPaintStyle = {
lineWidth: 2,
strokeStyle: "#deea18",
joinstyle: "round"
},
// .. and this is the hover style.
connectorHoverStyle = {
lineWidth: 2,
strokeStyle: "#2e2aF8"
};
var sourceEndpoint = {
endpoint: "Dot",
paintStyle: { fillStyle: "#225588", radius: 2 },
isSource: true,
connector: ["Straight", { stub: 40}],
connectorStyle: connectorPaintStyle,
hoverPaintStyle: connectorHoverStyle,
connectorHoverStyle: connectorHoverStyle,
dragOptions: {}
};
var targetEndpoint = {
endpoint: "Dot",
paintStyle: { fillStyle: "#558822", radius: 2 },
hoverPaintStyle: connectorHoverStyle,
maxConnections: -1,
dropOptions: { hoverClass: "hover", activeClass: "active" },
isTarget: true
};
_addEndpoints = function (toId, sourceAnchors, targetAnchors) {
if (sourceAnchors)
for (var i = 0; i < sourceAnchors.length; i++) {
var sourceUUID = toId + sourceAnchors[i];
allSourceEndpoints.push(jsPlumb.addEndpoint(toId, sourceEndpoint, { anchor: sourceAnchors[i], uuid: sourceUUID }));
}
if (targetAnchors)
for (var j = 0; j < targetAnchors.length; j++) {
var targetUUID = toId + targetAnchors[j];
allTargetEndpoints.push(jsPlumb.addEndpoint(toId, targetEndpoint, { anchor: targetAnchors[j], uuid: targetUUID }));
}
};
_addEndpoints("plumbleft", ["RightMiddle"]);
_addEndpoints("plumbright", null, ["LeftMiddle"]);
jsPlumb.connect({ uuids: ["plumbleftRightMiddle", "plumbrightLeftMiddle"] });
});
</script>
</head>
<body>
<div style="height: 100px">
</div>
<table >
<tr >
<td >
<div id="leftdiv" style="height: 200px; overflow: auto; ">
Here's some longer text<br />
Here's some text<br />
Here's some text<br />
<span id="plumbleft">linked</span><br />
Here's some text<br />
Here's some text<br />
Here's some text<br />
Here's some text<br />
Here's some text<br />
Here's some text<br />
Here's some text<br />
Here's some text<br />
Here's some text<br />
Here's some text<br />
Here's some text<br />
Here's some text<br />
Here's some text<br />
Here's some text<br />
Here's some text<br />
Here's some text<br />
Here's some text<br />
Here's some text<br />
Here's some text<br />
Here's some text<br />
Here's some text<br />
Here's some text<br />
</div>
</td>
<td>
<div id="rightdiv" style="height: 200px; overflow: auto">
Here's some longer text<br />
Here's some text<br />
Here's some text<br />
<span id="plumbright">linked</span><br />
Here's some text<br />
Here's some text<br />
Here's some text<br />
Here's some text<br />
Here's some text<br />
Here's some text<br />
Here's some text<br />
Here's some text<br />
Here's some text<br />
Here's some text<br />
Here's some text<br />
Here's some text<br />
Here's some text<br />
Here's some text<br />
Here's some text<br />
Here's some text<br />
Here's some text<br />
Here's some text<br />
Here's some text<br />
Here's some text<br />
Here's some text<br />
Here's some text<br />
</div>
</td>
</tr>
</table>
</body>
</html>
We've tried various z-index tricks to clip/hide the lines (or parts of lines) that shouldn't be shown, but without any luck. Can anyone suggest how to deal with it, or suggest another approach, using jsplumb or otherwise?
Thanks in advance for any thoughts.
i created a jsFiddle from your code:
http://jsfiddle.net/sporritt/fpbqd/10/
..it is possible to do what you want. But you have to make that mask div absolutely positioned, which may get tricky in your final UI. Anyway. It's perhaps a little hacky but it can be done.

Resources