How to create a pykcharts instance by retrieving an existing pykcharts chart at page load? - pykcharts

How to create a pykcharts instance by retrieving a table of existing pykcharts the page loads?
I mean, when I load my page I load a saved chart and put it in my div
eg:
<div id = "MyChart"> <svg ....> it pykcharts </ svg> </ div>
I would like to get an instance of pykcharts with this chart to edit it.
Is it possible?

Currently, to achieve this, you will have to clear the DOM and reinitialise the chart and call the execute again with the edited configuration passed to the chart. There is no provision to edit the existing chart.

Related

i want to create dynamic sidebar in mern stack which render another component when they clicked

for your understanding i attached w3school screenshot.
enter image description here
if u have ever visited w3school website u will understand my requirement easily.
i want to create these html sidebar dynamic from my admin dashboard. first i will create one sidebar title name then insert content according to title name and so on..... for best understanding you can assume that i want to create w3school clone dynamic from where i can dynamic create sidebar and content. i read about react router dom and many more but not able to create like this.
You can use react-router for navigation and then render according to the route
https://codesandbox.io/s/c2zs4
here is the example I found, it used react-router for navigation and render components according to the route.
add in _app.js file
you can put a header here
<div className="flex">
<div className="W-2/6>
<Sidebar/>
</div>
<div className="w-4/6">
page component here
</div>
</div>
and footer here
I used tailwind CSS

Dynamically change TEXT of Tab Item

How we can change the text of the TAB Item dynamically based on Order Type in Sales order screen.
for example: for TR order type, I want to change Document Details to Transfer Details.
To my knowledge there is no DAC binding for changing Tab Header Text from the business logic layer (graph). A possible workaround if you have a limited number of alternative Tab Header Text could be to create a tab for each of them and dynamically hide them based on your display condition.
How to hide Tabs in Acumatica:
Hiding a tab from the user interface dynamically
The other option would be to use JavaScript to change the inner element of the Tab Header Control.
Both options are less than ideal and can have an impact if you're looking to have your customization certified by Acumatica but if it's a hard requirement that's the only ways to do it that I'm aware of.
In the following example I'm using the hardcoded HTML Control ID for the Tab Header Control that I looked up using the Inspect Element feature provided by HTML browsers:
<asp:Content ID="cont1" ContentPlaceHolderID="phDS" Runat="Server">
<script type="text/javascript">
$(function() {
$(document)
.ready(function() {
document.getElementById("ctl00_phG_tab_tab0").innerHTML = "My Tab Header Text";
});
});
</script>
[...]
</asp:Content>

Overriding Widget View in Orchard

I setup a custom content definition, query and projection inside Orchard (1.8) and just about everything with it works great, including overriding the display view on the projection page's URL. The only issue I'm running into is when I put that same projection in a widget, I can't seem to figure out how to override the view for it. The automatically generated HTML is this:
<p class="text-field"><span class="name">Name:</span> <span class="value">/** Title from content item **/</span></p>
<p>more</p>
<p>asdfasdfasdrerfwerqaq324f421 more</p>
<p class="date-time-field date-time-field-date">
<span class="name">Date:</span>
<span class="value">/** Date from content item **/ </span>
</p>
I've tried using the Shape tracer to create an alternate view, but even when I only have #Display(Model.Content) in the new view, it still puts all of that extra stuff in it which is more than I need to show on this view. The shape tracer says the active template is my new one with only that value in it, so I'm not sure where all the extra HTML is coming from here (though it does show on the HTML tab of the Shape tracer).
How can I override the view for this widget?
If the extra HTML is only appearing when you post the projection as a widget it is probably due to wrapper tags added through code or through the widget wrapper template. Try either of these methods:
Check Widget.Wrapper.cshtml to see if that view template contain the extra HTML. I don't remember if this shape shows up in the shape tracer, it might show up under the wrappers section.
You can also try the trick below - this can remove unwanted markup in some cases, I use it for the menu navigation widget. It removes any wrappers that were added through code. Make your widget template look like this:
#Display(Model.Content)
#{
Model.Metadata.Wrappers.Clear();
}

Google Charts API get graph object from div

I have drawn several graphs on my webpage using the Google Charts API. If i want to clear them, i can use the chart's clearChart() method. But lets say i have a div with id="mydiv" which has a line chart drawn in it. To clear it, i would have to first get the chart objectcand then call clearChart(). But how do i get the chart object ?
If you used JavaScript to render charts you should had saved a reference to chart objects to clear them after.
If you do not have those references but have the div behaving as a container them you can remove or clear the div element from browser tree nodes.
document.getElementById( 'mydiv' ).innerHTML = '';
Please add additional notes for clarification.

Is it possible to format a NumberField in a page layout?

I'm developing a SharePoint publishing site and setting up its content types and page layouts. I need to display the value for a Year field with type Number. The markup currently is:
<SharePointWebControls:NumberField FieldName="Year" runat="server" id="Year" />
The problem with the default behaviour is that it shows each number with a comma, e.g. "2,009" instead of "2009". Is there a way I can set some sort of String.Format syntax on the field to make it display correctly?
I tried creating a new rendering template which looks like this:
<SharePoint:RenderingTemplate ID="YearNumberField" runat="server">
<Template>
<SharePoint:FormField ID="TextField" runat="server"/>
</Template>
</SharePoint:RenderingTemplate>
... but there doesn't appear to be any 'Format' property on the FormField object.
Thanks for any help.
Update:
I tried wrapping the SharePoint:FormField tag inside SharePoint:FormattedString. Unfortunately the field was not formatted, same results as this question.
The issue is that the rendering template must use FormField. This always renders the value in the format: 1,989 . To resolve this the rendered text needs to be trapped and altered to get the desired output. Here are two approaches to resolving this:
1. Write a custom control inherited from NumberField
The RenderFieldForDisplay and RenderFieldForInput methods can be overridden to provide the desired output. Additional properties can be added to the control to describe additional behaviour.
Pros: No changes to rendering templates required.
2. Write a custom control for use in the rendering template
A control that (for example) uses regular expressions to alter text can wrap around the FormField control.
<SharePoint:RenderingTemplate ID="YearField" runat="server">
<Template>
<RX:RegexManipulatorControl runat="server"
Mode="Replace"
Expression=","
Replacement="">
<SharePoint:FormField runat="server"/>
</RX:RegexManipulatorControl>
</Template>
</SharePoint:RenderingTemplate>
Pros: Generic solution can be used for any type of field.
from Just Another SharePoint Blog
Open the list view in SharePoint
Designer.
Right click on the data view web part.
(the list)
Select Convert to XSLT Data View
Click on the number field you would
like to format
A > will appear showing Data Field,
Format As
Click on the link below Format As -
Number formatting options
Under Options deselect Use 1000
separator
Click OK
Save your changes and hit F12 to
preview

Resources