Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

How to Change the Styling of Table when using dataframe.plot('table_plot_area').table()#627

AnsweredbyRahulDas-dev
RahulDas-dev asked this question inQ&A
Discussion options

Here is My table

image

I want style the table little bit , may be changing background color, and margin, but not able to locate the proper layout and config ,

image

I can see it takes a plotconfig object , but able to figureout the same in docs

Kindly help.

You must be logged in to vote

Replies: 2 comments

Comment options

OK , I manage to find the answer ,

The Layout Type Defination

interface Layout {  autosize?: boolean;  automargin?: boolean;  width?: number;  height?: number;  margin?: Margins;  paper_bgcolor?: string;  plot_bgcolor?: string;  showlegend?: boolean;  legend?: Legend;  title?: Title;  xaxis?: XAxis;  yaxis?: YAxis;  barmode?: string;  bargap?: number;  bargroupgap?: number;  boxmode?: string;  boxgap?: number;  boxgroupgap?: number;  hovermode?: string;  hoverlabel?: Hoverlabel;  hoverdistance?: number;  hoverinfo?: string;  hoverlabels?: Hoverlabels;  hoverrecalculate?: boolean;  mapbox?: Mapbox;  geo?: Geo;  images?: Array<Image>;  shapes?: Array<Shape>;  annotations?: Array<Annotation>;  angularaxis?: Angularaxis;  coloraxis?: Coloraxis;  radialaxis?: Radialaxis;  scene?: Scene;  sliders?: Array<Slider>;  sunburst?: Sunburst;  ternary?: Ternary;  waterfall?: Waterfall;  [key: string]: any;}

The Config Type Defination

interface Config {  displaylogo?: boolean;  doubleClickDelay?: number;  editable?: boolean;  scrollZoom?: boolean;  modeBarButtonsToAdd?: Array<ModeBarButton>;  modeBarButtonsToRemove?: Array<string>;  modeBarButtonsToToggle?: Array<string>;  staticPlot?: boolean;  displayModeBar?: boolean;  watermark?: Watermark;  responsive?: boolean;  toImageButtonOptions?: ToImageButtonOptions;  showTips?: boolean;  sendData?: boolean;  plotlyServerURL?: string;  edits?: Edits;  linkText?: string;  locale?: string;  [key: string]: any;}

Here is my code for adjusting margins

const DataTable: FunctionComponent = ():ReactElement =>{  const [is_table_populated, setTableisPolulated] = useState<boolean>(true)  const {dataframe} = useContext(DataContext)  const headerStyle = {      align: "center",      fill: { color: ['lightgrey'] },      font: { family: "Arial", size: 15, color: "black" },          }    const cellStyle = {      align: ["center"],      line: { color: "black", width: 1 }    }  useEffect(()=>{      if (dataframe.size > 0){          setTableisPolulated(true)          dataframe.plot('table_plot_area').table({              config: {                tableHeaderStyle: headerStyle,                tableCellStyle: cellStyle,                              },              layout: {                // title: "Table displaying the Titanic dataset",                automargin: true,                margin: {t:0,r:0,b:0,l:0},                paper_bgcolor: 'gray'              }            })      }else{          setTableisPolulated(false)      }  },[dataframe])  return (      <div className='static-table'>          <div className={classNames("block",{'h-96': is_table_populated })} id='table_plot_area'></div>      </div>  )};export default DataTable

image

You must be logged in to vote
0 replies
Comment options

Closing ....

You must be logged in to vote
0 replies
Answer selected byRahulDas-dev
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
Q&A
Labels
None yet
1 participant
@RahulDas-dev

[8]ページ先頭

©2009-2025 Movatter.jp